@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 @endifYou have {{$cart_count > 1 ? $cart_count.' items' : $cart_count.' item'}} in your cart
Product | Price | Quantity | Remove | |
---|---|---|---|---|
{{$cart->product_name}} ({{$cart->color}}) ({{$cart->size}}) | {{Helper::setPriceFormat($cart->price)}} |
|
||
No Item in your cart | ||||
{{$cart->name}} ({{$cart->options->color}}) ({{$cart->options->size}}) | {{Helper::setPriceFormat($cart->price)}} |
|
||
No Item in your cart |
Cart Subtotal | {{Helper::setPriceFormat($cart_subtotal)}} |
Total | {{Helper::setPriceFormat($cart_total) }} |