@php
$total = 0;
// Check if the cart exists and is not empty
if (session()->has('cart') && count(session('cart')) > 0) {
// Calculate the total price only if the cart is not empty
foreach (session('cart') as $item) {
$total += $item['price'] * $item['quantity'];
}
}
@endphp