How to Accessing Session Data in Laravel ?

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What do you understand by orm?

420


How to create migrations in laravel? Explain step by steps.

389


What do you know about php artisan? Mention some artisan command.

397


What do you understand by eloquent orm?

414


Explain short notes on Laravel - Artisan Console and commands ?

1009






How to enable/disable maintenance mode in laravel 5?

413


Write down the name of some aggregates methods provided by the laravel's query builder.

418


How to enable multiple php versions in homestead?

397


What is laravel?

436


What are Uses While Using the properties of Request instance ?

507


what is meant by Views ?

798


What is laravel route?

429


What is laravel illuminate?

399


How to configure network interfaces in homestead?

395


What is laravel horizon?

452