app/Http/Controllers/CartController.php
/**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
Display a listing of the resource.
@return \Illuminate\Http\Response
Display a listing of the resource . @return \ Illuminate \ Http \ Response
public function index()
    {
        $user= Auth::user();
        $Items=null;
        if ($user) {
            $icarrito = Cart::session($user->id)->getContent();
            $subtotal = Cart::session($user->id)->getSubTotal();
            if(Cart::session($user->id)->getTotalQuantity()!=0)
                {
                    $Items=Cart::getContent(Auth::user()->id);
                }
        }
        else {
            $subtotal=0;
        }
        return view('cart/cart')->with(['Items'=>$Items ,'Subtotal'=> $subtotal]);
    }
public function index ( ) { $ user = Auth :: user ( ) ; $ Items = null ; if ( $ user ) { $ icarrito = Cart :: session ( $ user -> id ) -> getContent ( ) ; $ subtotal = Cart :: session ( $ user -> id ) -> getSubTotal ( ) ; if ( Cart :: session ( $ user -> id ) -> getTotalQuantity ( ) != 0 ) { $ Items = Cart :: getContent ( Auth :: user ( ) -> id ) ; } } else { $ subtotal = 0 ; } return view ( 'cart/cart' ) -> with ( [ 'Items' => $ Items , 'Subtotal' => $ subtotal ] ) ; }
Display a listing of the resource.
Display a listing of the resource .
//dd($subtotal); //dd( Cart::getContent($user->id));