fix: addToCart policy was broken in product #86 + homepage #85

This commit is contained in:
Noah Lancien 2026-02-20 15:03:28 +01:00
parent 3a332fc1c3
commit 7150dc1c7a
2 changed files with 10 additions and 4 deletions

View file

@ -44,9 +44,12 @@
@endif
<div class="card-action d-flex justify-content-center justify-content-lg-between align-items-center w-100">
<img class="card-action-nutriscore d-none d-lg-block" src="{{ asset(config('app.theme') . "/img/nutriscore/nutriscore-" . $product->foodProduct->nutriscore . ".png") }}">
@can('addToCart', $product)
@if(
Auth::guard('customer')->user() &&
Auth::guard('customer')->user()->can('addToCart', $product)
)
<basket-buttons :product-id='{{ $product->id }}'></basket-buttons>
@endcan
@endif
</div>
</div>
</div>

View file

@ -53,9 +53,12 @@
<span class="text-lowercase">/{{ $product->sell_unit }}</span>
</p>
</div>
@can('addToCart', $product)
@if(
Auth::guard('customer')->user() &&
Auth::guard('customer')->user()->can('addToCart', $product)
)
<basket-buttons :product-id='{{$product->id}}'></basket-buttons>
@endcan
@endif
</div>
@if ($product->weight_variable)
<p class="fst-italic text-muted">*Produit vendu au kilo : @fmt_currency($product->priceKgTtc)/kg</p>