From 95afd46406bbcb6455476551a5095acd61d2b04b Mon Sep 17 00:00:00 2001 From: kusowl Date: Thu, 5 Mar 2026 18:07:46 +0530 Subject: [PATCH] fix: add isFavorite on Product show response --- backend/app/Http/Controllers/ProductController.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/app/Http/Controllers/ProductController.php b/backend/app/Http/Controllers/ProductController.php index c003c10..635c1cd 100644 --- a/backend/app/Http/Controllers/ProductController.php +++ b/backend/app/Http/Controllers/ProductController.php @@ -27,7 +27,10 @@ public function store(CreateProductRequest $request) public function show(string $slug) { - $product = Product::where('slug', $slug)->with(['category:id,name,slug', 'images:id,path,product_id'])->firstOrFail(); + $product = Product::where('slug', $slug) + ->with(['category:id,name,slug', 'images:id,path,product_id']) + ->withExists('favoritedBy') + ->firstOrFail(); return new ProductResource(ProductDTO::fromModel($product)); }