@php if (auth()->user() != null) { $user_id = Auth::user()->id; $cart = \App\Models\Cart::where('user_id', $user_id)->get(); } else { $temp_user_id = Session()->get('temp_user_id'); if ($temp_user_id) { $cart = \App\Models\Cart::where('temp_user_id', $temp_user_id)->get(); } } $total = 0; if(isset($cart) && count($cart) > 0){ foreach ($cart as $key => $cartItem){ $product = \App\Models\Product::find($cartItem['product_id']); $total = $total + cart_product_price($cartItem, $product, false) * $cartItem['quantity']; } } @endphp {{ single_price($total) }} ({{(isset($cart) && count($cart) > 0) ? count($cart) : 0 }} {{translate('Items')}})