@php use App\Models\Detail; $details = Detail::first(); @endphp @extends('layouts.land') @section('title', 'Cart') @section('content') @include('sweetalert::alert') @if(!Auth::check())
@endif
@php $total = 0; @endphp @forelse(session('cart', []) as $id => $details) @php $price = $details['price'] ?? 0; $quantity = $details['quantity'] ?? 1; $subtotal = $price * $quantity; $total += $subtotal; @endphp @empty @endforelse @if ($total > 0) @endif
Product Price Quantity Subtotal
{{ $details['name'] ?? 'No name' }}
{{ $details['desc'] ?? 'No description available' }}
₦{{ number_format($price, 2) }}
@csrf
₦{{ number_format($subtotal, 2) }}
@csrf @method('DELETE')
Your cart is empty
Continue Shopping Total ₦{{ number_format($total, 2) }}
@csrf @method('DELETE')
@endsection