i want to change the attribute "cantidad" inside my session('cart') through a post form which have a input type="num" that will have the quantity to change on the session.
But i cant change it with success , it doesnt do nothing.
Session Code
$cart = [
$id => [
"id" => $product->id,
"nombre" => $product->nombre,
"cantidad" => 1,
"precio" => $product->precio,
"foto" => $product->imagen1
]
Trying to change session attribute
public function updateCart($id , Request $request){
$cart = session()->get('cart');
foreach($cart as $index => $product){
if($product["id"] == $id){
$producto["cantidad"] = $request->cantidad;
}
}
session()->put('cart' , $cart);
return view('carrito/carrito');
}
Where im wrong?
Sorry for ask this , im new on this jaja