Crinsane / LaravelShoppingcart

A simple shopping cart implementation for Laravel
MIT License
3.67k stars 1.73k forks source link

Please supply a valid price problem #642

Open lubnaO opened 3 years ago

lubnaO commented 3 years ago

public function index(){ $cartItems=Cart::content(); return view ('cart.index', compact('cartItems')); }

    public function addItem($id){
    $product=Product::findOrFail($id);
    $cartItems= Cart::add([
         'id' => $product->id,
         'name' => $product->pro_name,
         'price' => $product->pro_price,
    ]);
    Cart::associate($cartItems->rowId, 'App\Product');
     return back();                                                               
}

These is in the controller. The issues is (Please supply a valid price.) This issues is show when press button product to add in cart ! Can any one help me !!