From 055ebf25578b751d578f81b6ade1457bc48d7f5e Mon Sep 17 00:00:00 2001 From: merdan Date: Wed, 21 Dec 2022 15:14:15 +0500 Subject: [PATCH] cache responces achyklar --- packages/Sarga/API/Http/Controllers/Brands.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/Sarga/API/Http/Controllers/Brands.php b/packages/Sarga/API/Http/Controllers/Brands.php index bc316f00e..103ff215d 100644 --- a/packages/Sarga/API/Http/Controllers/Brands.php +++ b/packages/Sarga/API/Http/Controllers/Brands.php @@ -65,12 +65,15 @@ class Brands extends \Webkul\RestApi\Http\Controllers\V1\Shop\ResourceController if ($sort = $request->input('sort')) { return $query->orderBy($sort, $request->input('order') ?? 'asc'); } - return $query->orderBy('position', 'desc')->orderBy('name', 'asc'); + + return $query->whereHas('flats', function($q){ + $q->where('status',1); + }) + ->orderBy('position', 'desc') + ->orderBy('name', 'asc'); }); - $query->whereHas('flats', function($q){ - $q->where('status',1); - }); + if (is_null($request->input('pagination')) || $request->input('pagination')) { $results = $query->paginate($request->input('limit') ?? 10);