@php // Determine the column class based on the number of cards per row. $columnClass = 'col-lg-4 col-md-6'; // Default to 3 columns if (isset($cardsPerRow) && $cardsPerRow == 4) { $columnClass = 'col-lg-3 col-md-6'; // 4 columns } elseif (isset($cardsPerRow) && $cardsPerRow == 6) { $columnClass = 'col-lg-2 col-md-6'; // 6 columns } elseif (isset($cardsPerRow) && $cardsPerRow == 3) { $columnClass = 'col-lg-4 col-md-6'; // 3 columns } // Check if the product is in the user's favorites *if the user is authenticated*. $isFavorite = false; if (Auth::check()) { $isFavorite = Auth::user()->favorites()->where('product_id', $product->id)->exists(); } @endphp
{{-- --}} {{-- Favorite Button --}}
@if ($product->is_new_arrival)
جديد
@elseif ($product->has_special_discount)
عرض
@endif @if ($product->stock == 0)
نفذت
@endif
{{ $product->name }}
{{ $product->category->name }}

{{ $product->name }}

{{ $product->price }}L.E
@if ($product->has_special_discount)
{{ $product->original_price }}L.E
@endif