Skip to content
Advertisement

PHP Laravel: How to set or get Session Data?

I want to store some data in session for some testing purpose. I have written the session code also in controller. But in console.log ->resources -> session I couldn’t find any value which I stored. If anyone help me to find the mistake which I have done in my controller please.

Here is my controller:

JavaScript

Advertisement

Answer

Storing data

To store data, you can use:

JavaScript

There is also another way, through the global helper:

JavaScript

Getting data

To get the variable, you’d use:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement