src/Traits/ShopOrderTrait.php
public function scopeWhereSKU($query, $sku) {
        return $query->join(
                config('shop.item_table'), 
                config('shop.item_table') . '.order_id', 
                '=', 
                $this->table . '.id'
            )
            ->where(config('shop.item_table') . '.sku', $sku);
    }
public function scopeWhereSKU($query, $sku) {
        return $query->join(
                config('shop.item_table'), 
                config('shop.item_table') . '.order_id', 
                '=', 
                $this->table . '.id'
            )
            ->where(config('shop.item_table') . '.sku', $sku);
    }
public function scopeWhereSKU ( $ query , $ sku ) { return $ query -> join ( config ( 'shop.item_table' ) , config ( 'shop.item_table' ) . '.order_id' , '=' , $ this -> table . '.id' ) -> where ( config ( 'shop.item_table' ) . '.sku' , $ sku ) ; }
Scopes class by item sku.
Optionally, scopes by status.

@param \Illuminate\Database\Eloquent\Builder $query  Query.
@param mixed                                 $sku    Item SKU.

@return this
Scopes class by item sku . Optionally scopes by status .