Hi everybody, I'm learning about Laravel. When i code shopping cart project, i have a problem with Session:
Table product: id, name, price.
In Controller i have code: $product = Product::find($id); Session::put('cart.'.$id , $product);
So, How to can get all data form above Session. Thank you ! (Sorry about my English).
Session::push('cart.items', $product); Session::get('cart.items'); // array
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!