Crypto Mag
Главная
About
Shipping
@php $cartCount = array_sum(session('cart', [])); @endphp @if($cartCount > 0)
{{ $cartCount }}
@endif
Товары в корзине:
@php $cart = session('cart', []); @endphp @if(count($cart) > 0) @foreach(\App\Models\Product::whereIn('id', array_keys($cart))->get() as $product) @php $quantity = $cart[$product->id]; $subtotal = $product->price * $quantity; $images = json_decode($product->images, true) ?? []; $imgSrc = $images[0] ?? 'no-image.png'; @endphp
{{ $product->name }}
{{ $quantity }} × ${{ number_format($product->price, 2) }}
${{ number_format($subtotal, 2) }}
@csrf
@endforeach
Итого:
${{ number_format( collect($cart)->map(fn($q, $id) => \App\Models\Product::find($id)->price * $q)->sum(), 2) }}
Оформить заказ
@else
Корзина пустая
@endif
@auth
{{ Auth::user()->name }}
Мои заказы
@csrf
Выйти
@else
Войти
@endauth
@yield('content')