product detail

This commit is contained in:
merdan 2023-05-04 13:18:40 +05:00
parent b9f6e44f2e
commit e0330b7b0f
2 changed files with 7 additions and 3 deletions

View File

@ -82,7 +82,11 @@ class Products extends ProductController
public function testProduct($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);

View File

@ -25,8 +25,8 @@ class ProductDetail extends Product
'brand' => $product->brand->name ?? '',
'color' => $product->color,
'images' => ProductImage::collection($product->images),
'color_variants' => ColorVariant::collection($this->related_products->where('status',true)),
'size_variants' => SizeVariant::collection($this->variants->where('status',true)),
'color_variants' => ColorVariant::collection($this->related_products),
'size_variants' => SizeVariant::collection($this->variants),
/* special price cases */
$this->merge($this->specialPriceInfo()),