Laravel Shopping Cart content not increasing


I’m trying to create a system where users can add multiple items to a ‘cart’ and download them all at once. I was following a youtube video and using this shopping cart package. I created a simple ‘add to cart’ button in each row of my item that will send the item’s ID and tried to display the number of items in my cart on the same page using:
Cart({{ \Gloudemans\Shoppingcart\Facades\Cart::content()->count() }}). After clicking it once, the number will increase to one but will remain there despite trying to add other items inside. May I ask what I’m doing wrong?

Here’s the snippet of my blade.php:

                        <a href="{{ url('model/download/'.$item->id) }}"class="btn btn-app btn-success"><i class="fa fa-save"></i>Download</a>
                        <a href="{{ url('model/view/'.$item->model_name) }}"class="btn btn-app btn-primary"><i class="fa fa-inbox"></i>View</a>
                        <form action="{{ route('model.cart') }}" method="POST">
                          <input type="hidden" value="{{$item->id}}" name="item_id">
                          <button type="submit" class="btn btn-app btn-info" ><i class="fa fa-edit"></i>Add to cart</button>
                        {{-- <a href="{{ url('model/addCart/'.$item->id) }}"class="btn btn-app btn-info" ><i class="fa fa-edit"></i>Add to cart</a> --}}

And here’s my controller:

public function addCart(Request $request){


    return Redirect()->back();


Have you tried to show {{Cart::count()}} instead {{Cart::content()->count()}}

Answered By – Manuel Glez

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published