dimanche 16 août 2020

Please can someone show me how to store products in Melihovv Shopping

Please am using MelohovvShoppingCart, I want to add products to my cart but it showing it's added successfully but when I try to retrieve all products in my cart I got empty. Please where am I wrong?. Thanks for your help.

Here's my code

public function store(Request $request)
{
           
    $cartItem = Cart::add($request->id, $request->name, $request->price, 1);
    return redirect()->route('cart.index')->with('message', 'Item was added to your cart!');
            
}

And this is my index

public function index()
{
    $cartContent = Cart::content();
    return view('pages.cart')->with('cartContent', $cartContent);
}

And this is views.

@foreach ($cartContent as $product)
    
    
    
    
@endforeach    


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire