Hi, i have a cart array stored in a session. so when product is added, it should store the ID as a key and the quantity as the value.
this code works without assigning a key:
Session::push('cart.products' , $product);
But im looking to do something like this:
Session::push('cart.products' , $product => $quantity);
so the array should look like:
array([products]=>array([ID]=>Quantity, [ID]=> Quantity, [ID]=> Quantity))
Any Ideas? Thanks
Found a solution:
Session::put('cart', array_add($cart = Session::get('cart'), $product, $quantity));
Thanks anyways
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community