From 7150dc1c7aea794061b485a79b70ad402130321b Mon Sep 17 00:00:00 2001 From: Noah Lancien Date: Fri, 20 Feb 2026 15:03:28 +0100 Subject: [PATCH] fix: addToCart policy was broken in product #86 + homepage #85 --- resources/views/front/sable/home.blade.php | 7 +++++-- resources/views/front/sable/product.blade.php | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/resources/views/front/sable/home.blade.php b/resources/views/front/sable/home.blade.php index d975c3f9..944bdd9e 100644 --- a/resources/views/front/sable/home.blade.php +++ b/resources/views/front/sable/home.blade.php @@ -44,9 +44,12 @@ @endif
foodProduct->nutriscore . ".png") }}"> - @can('addToCart', $product) + @if( + Auth::guard('customer')->user() && + Auth::guard('customer')->user()->can('addToCart', $product) + ) - @endcan + @endif
diff --git a/resources/views/front/sable/product.blade.php b/resources/views/front/sable/product.blade.php index 89b87c37..1f583045 100644 --- a/resources/views/front/sable/product.blade.php +++ b/resources/views/front/sable/product.blade.php @@ -53,9 +53,12 @@ /{{ $product->sell_unit }}

- @can('addToCart', $product) + @if( + Auth::guard('customer')->user() && + Auth::guard('customer')->user()->can('addToCart', $product) + ) - @endcan + @endif @if ($product->weight_variable)

*Produit vendu au kilo : @fmt_currency($product->priceKgTtc)/kg