I'm going crazy and I can not find a solution to the problem. I've been seeing forums in English and the answers they propose do not work for me. Would anyone know how to do it?
I'm going crazy and I can not find a solution to the problem. I've been seeing forums in English and the answers they propose do not work for me. Would anyone know how to do it?
The way to delete elements of the session in Laravel is:
For a particular item:
$request->session()->forget('key');
or
Session::forget('key');
For all the elements of the session:
$request->session()->flush();
or
Session::flush();
According to Laravel's official documentation: Sessions
Thanks for your reply but that does not work, it was the first thing I did, and I deleted the entire array. I already found the solution. I spend a lot of time looking at forums, and apparently laravel does not have a method to delete elements from an array of a session.
1- You have to obtain the value of the index you want to eliminate. 2-I'm going through Axios. 3-I recover it in the controller. 4- I do a pull () of the array session 5- I use unset (index_delete) 6-I make a put () of the array. In this way I have managed to remove elements from a session array.