Jul 11, 2016
0
Level 1
Laravel 5.1 Session is not storing all data
$clickarray = array();
if (Session::has('list_' . $ward)) {
$click_selectedking_id = Session::get('list_' . $ward);
$key = array_search($click_id, $click_selectedking_id);
if ($key === FALSE) {
array_push($click_selectedking_id, $click_id);
$clickarray = $click_selectedking_id;
} else {
unset($click_selectedking_id[$key]);
$clickarray = $click_selectedking_id;
}
} else {
array_push($clickarray, $click_id);
}
Session::put('list_' . $ward, $clickarray);
Session::save();
return $clickarray;
I am storing an array in session. Purpose is to highlight selected table row after page refresh. Using an ajax request to this function with a key to store in the session. Sometimes Session is not keeping the last value passed.
Session::put('list_' . $ward, $clickarray);
Session::save();
return Session::get('list_' . $ward);
I am getting the data here. But not getting on the next request. Missing last value pass to this function. I feel there is something wrong with session.
Please or to participate in this conversation.