From bbfacd0934e9497b54c5cb036434b028d02608fd Mon Sep 17 00:00:00 2001 From: merdan Date: Thu, 4 May 2023 13:21:31 +0500 Subject: [PATCH] product detail --- packages/Sarga/API/Http/Controllers/Products.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/Sarga/API/Http/Controllers/Products.php b/packages/Sarga/API/Http/Controllers/Products.php index 9fb8f5b49..bbd4fc6ff 100644 --- a/packages/Sarga/API/Http/Controllers/Products.php +++ b/packages/Sarga/API/Http/Controllers/Products.php @@ -60,8 +60,15 @@ class Products extends ProductController public function product($id){ $product = $this->productRepository->select('id','attribute_family_id','type','brand_id') - ->with(['brand','related_products'=> fn($rp) => $rp->select('id','type','attribute_family_id','brand_id')->with('brand'), + ->with(['brand','related_products'=> fn($rp) => $rp->select('id','type','attribute_family_id','brand_id') + ->with('brand') + ->whereHas('product_flat', function($qwh){ + $qwh->where('status',1); + }), 'variants' => function($query){ + $query->whereHas('product_flat', function($qwh){ + $qwh->where('status',1); + }); $query->with(['product_flats' => function($qf){ $channel = core()->getRequestedChannelCode();