@php
$wishlist_count = 0;
if (auth()->user()) {
$wishlist_count = DB::table('wishlist')
->where('user_id', auth()->user()->id)
->count();
}
@endphp
@if ($wishlist_count > 0)
{{ $wishlist_count }}
@endif
@php
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
$cart_count = 0;
if (Auth::check()) {
// Check if user is authenticated
$cart_count = DB::table('cart')->where('user_id', Auth::id())->count();
} else {
// Guest user cart from session
$cart = session('cart', []);
$cart_count = count($cart);
}
@endphp
@if ($cart_count > 0)
{{ $cart_count }}
@endif
{{-- --}}
@if (!auth()->user())
@else
@endif