AucT's avatar
Level 2

how to remove single array element from session?

Hi I can't figure out how to remove array element by index.

for example I have

$array = [ 123 => 456, 124 => 457, 777 => 123 ]; Session::set('abc.xyz', $array);

So how to remove $array[124] from current session

0 likes
3 replies
AucT's avatar
Level 2

$_SESSION variable didn't work in laravel (or at leas for me)

but the issue was not with session. I was saving not an array, but collection, so it didn't forget the element. so I just set $collection->all() and everythink work fine

Please or to participate in this conversation.