Session::push('cart.items', $product);
Session::get('cart.items'); // array
source:http://laravel.com/docs/session#session-usage
Instead of creating a shopping cart from scratch, I would recommend you to use a package for the cart or ecommerce system. You can easily get an Laravel based ecommerce site on your server by using packages for that. Here is an example: https://www.cloudways.com/blog/laravel-ecommerce-website-with-aimeos-package/
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community