How can I delete only a single item from an array in Laravel with Sessions. When I try to do it now with Session:pull
, it just deletes the whole session object with key estate.id
and with all the items in the array. I want to match only the object that has the same id as the id received from the input.
Simplified code
$estateId = Input::get('id', null);
if ($processType == "add") {
Session::push('estate.id', $estateId);
}
else {
if (in_array($estateId, $data)) {
$value = Session::pull('estate.id', $estateId);
}
}