cache responces achyklar
This commit is contained in:
parent
427d7bfc79
commit
fb3bb6ba44
|
|
@ -68,7 +68,9 @@ class Brands extends \Webkul\RestApi\Http\Controllers\V1\Shop\ResourceController
|
|||
$query = $query->orderBy('position', 'desc')->orderBy('name', 'asc');
|
||||
}
|
||||
|
||||
return $query->has('products');
|
||||
return $query->whereHas('flats', function($q){
|
||||
$q->where('status',1);
|
||||
});
|
||||
});
|
||||
|
||||
if (is_null($request->input('pagination')) || $request->input('pagination')) {
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ use Laravel\Scout\Searchable;
|
|||
use Sarga\Brand\Contracts\Brand as BrandContract;
|
||||
use Webkul\Category\Models\CategoryProxy;
|
||||
use Webkul\Marketplace\Models\SellerProxy;
|
||||
use Webkul\Product\Models\ProductFlatProxy;
|
||||
use Webkul\Product\Models\ProductProxy;
|
||||
|
||||
class Brand extends Model implements BrandContract
|
||||
|
|
@ -79,6 +80,10 @@ class Brand extends Model implements BrandContract
|
|||
return $this->hasMany(ProductProxy::modelClass(), 'brand_id');
|
||||
}
|
||||
|
||||
public function flats():HasMany{
|
||||
return $this->hasMany(ProductFlatProxy::modelClass(), 'brand_id');
|
||||
}
|
||||
|
||||
public function sellers():BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(SellerProxy::modelClass(), 'seller_brands');
|
||||
|
|
|
|||
Loading…
Reference in New Issue