How do I print all running session variable in Laravel 5.1?
I want to print all the running session variable. Currently I can retrieve single running session for given value but don't know the function for print all at one time with one function something like
{{ Session::get(all)}}
If you just want to see contents of session, try dd() : dd(session()->all()); If not, just use this to get all info: $data = session()->all();
php session_start(); echo "<h3> PHP List All Session Variables</h3>"; foreach ($_SESSION as $key=>$val) echo $key." ".
Deleting Session Data $request->session()->forget('key'); Use flush() method instead of forget() method to delete all session data. Use the pull() method to retrieve data from session and delete it afterwards.
The correct syntax for this is: Session::set('variableName', $value); For Laravel 5.4 and later, the correct method to use is put : Session::put('variableName', $value);
If you just want to see contents of session, try dd()
:
dd(session()->all());
If not, just use this to get all info:
$data = session()->all();
You can also use dd(Session::all());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With