@php $cartCount = 0; $customerId = auth()->guard('customer')->id(); if ($customerId) { $cartCount = \App\Models\Cart::where('customer_id', $customerId) ->where('status', 'active') ->first()?->items->sum('quantity') ?? 0; } elseif (session()->has('cart_session_id')) { $cartCount = \App\Models\Cart::where('session_id', session('cart_session_id')) ->where('status', 'active') ->first()?->items->sum('quantity') ?? 0; } @endphp merge(['class' => 'absolute -top-2 -right-2 bg-[#2C5530] text-white text-xs font-medium rounded-full h-5 w-5 flex items-center justify-center ' . ($cartCount > 0 ? '' : 'hidden')]) }}> {{ $cartCount }}