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

How to install valet?

0 Answers  


What are the difference between insert() and insertgetid() in laravel?

0 Answers  


How to disable maintaince mode in laravel?

0 Answers  


What is antiforgerytoken mvc5?

0 Answers  


What is the best way to learn laravel?

0 Answers  


What is the difference between forget() and the pull() method ?

0 Answers  


What is escaping a string?

0 Answers  


What is the difference between namespace and use in laravel?

0 Answers  


How to use custom table in laravel modal?

0 Answers  


What is a session in laravel?

0 Answers  


In laravel, what is fillable attribute in a model?

0 Answers  


How to bind a service container to a service provide.

0 Answers  


Categories