Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

printing all running session variable in laravel 5.1

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)}} 
like image 464
prashant sutail Avatar asked Apr 22 '16 13:04

prashant sutail


People also ask

How can get all session in Laravel?

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();

How can I see all session variables in PHP?

php session_start(); echo "<h3> PHP List All Session Variables</h3>"; foreach ($_SESSION as $key=>$val) echo $key." ".

How do I flush a specific session in Laravel?

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.

How are session variables stored in Laravel?

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);


2 Answers

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(); 

More on this here.

like image 102
Alexey Mezenin Avatar answered Sep 18 '22 08:09

Alexey Mezenin


You can also use dd(Session::all());

like image 36
Harry Bosh Avatar answered Sep 18 '22 08:09

Harry Bosh