class ControlController extends Controller
{
public function anyadirCarrito($id, $quan) {
$productoCarrito = (object)array(
'id' =>$id,
'cantidad' => $quan,
);
\Session::push('cart', $productoCarrito);
return \Session::get('cart');
}
}
I'm trying every time I call this function to store the past data without overwriting the existing ones, but every time I call it I overwrite the array that happened to it, which I could do so that it does not overwrite the data every time What do I call the function? And in case you want to pass an id and delete the associated array but not the others you could do?