@extends('layouts.app') @section('content') @if(\Auth::user()) @php $cart_count = App\Models\ShoppingCart::where('user_id', '=', \Auth::user()->id)->count(); $cart_subtotal = App\Models\ShoppingCart::where('user_id', '=', \Auth::user()->id)->sum('subtotal'); $cart_total = App\Models\ShoppingCart::where('user_id', '=', \Auth::user()->id)->sum('cart_total'); @endphp @else @php $cart_count = Cart::count(); $cart_subtotal = Cart::subtotal(); $cart_total = Cart::total(); // dd($cart_subtotal); @endphp @endif
@if($cart_count > 0)
@include('layouts.session')

You have {{$cart_count > 1 ? $cart_count.' items' : $cart_count.' item'}} in your cart

@if(\Auth::user()) {{-- Logged User --}} @php $shopping_cart = App\Models\ShoppingCart::where('user_id', '=', \Auth::user()->id)->get(); @endphp @forelse($shopping_cart as $key => $cart) @php $path = asset($cart->product_image); if($cart->product_image == null || $cart->product_image == ''){ $path = asset('/frontend/assets/images/noimage_cart.jpg'); } @endphp @empty @endforelse @else {{-- Guest --}} @forelse(Cart::content() as $key => $cart) @php $path = asset(Helper::getFirstImageForCart($cart->options->product_data['product_images'], '80_80')); if(empty($cart->options->product_data['product_images'])){ $path = asset('/frontend/assets/images/noimage_cart.jpg'); } @endphp @empty @endforelse @endif
  Product Price Quantity Remove
{{$cart->product_name}} {{$cart->product_name}} ({{$cart->color}}) ({{$cart->size}}) {{Helper::setPriceFormat($cart->price)}}
@method('delete') @csrf
No Item in your cart
{{$cart->options->product_name}} {{$cart->name}} ({{$cart->options->color}}) ({{$cart->options->size}}) {{Helper::setPriceFormat($cart->price)}}
@method('delete') @csrf
No Item in your cart
Cart Totals
Cart Subtotal {{Helper::setPriceFormat($cart_subtotal)}}
Total {{Helper::setPriceFormat($cart_total) }}
Proceed To CheckOut
@else
No Item in your cart
Continue Shopping
@endif
@endsection @push('js') @endpush