I try to add a key and a value in a already existing session with laravel and this goes fine but the key is not as I pass with the Session function
public function selectCar() {
$reservation['car'] = Input::get('id');
if (Session::has('car')) {
Session::forget('car');
}
if (Input::has('id'))
{
Session::push('reserveringen', $reservation['car']);
}
$data = Session::all();
return Redirect::back()->with('success', 'Auto gekozen')->with('sessie', $data);
}
The output is
[reserveringen] => Array
(
[pickupdate] => 'date'
[pickuptime] => 'time'
[returndate] => 'date'
[returntime] => 'time'
[0] => 37
)
But It shows 0 instead of 'car' The next thing is that if the session already contains car I want the old one to delete and be replace by the new one. Can someone give me an example of how to achieve this?