How to Accessing Session Data in Laravel ?



How to Accessing Session Data in Laravel ?..

Answer / amit khanna

To access the session data, we need an instance of session which can be accessed via HTTP request.
After getting the instance, we can use the get() method, which will take one argument, key, to get the session data.

Syntax : $value = $request->session()->get('key');

You can use all() method to get all session data instead of get() method.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Laravel PHP Framework Interview Questions

Which class is used to handle exceptions?

0 Answers  


How do I start laravel in ubuntu?

0 Answers  


How to get, set cookies in laravel?

0 Answers  


How to do 301 redirects in laravel?

0 Answers  


How to share sites with external world on valet?

0 Answers  


How to serve sites with tls on valet?

0 Answers  


What is laravel orm?

0 Answers  


What do you know about closures in laravel?

0 Answers  


What is contextual binding?

0 Answers  


Command to connect vagrant via ssh?

0 Answers  


What is the laravel?

0 Answers  


Is react a library or a framework?

0 Answers  


Categories