fix: add isFavorite on Product show response
This commit is contained in:
parent
0f56303d59
commit
95afd46406
@ -27,7 +27,10 @@ public function store(CreateProductRequest $request)
|
|||||||
|
|
||||||
public function show(string $slug)
|
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));
|
return new ProductResource(ProductDTO::fromModel($product));
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user