Skip to content
Advertisement

Laravel – Session returns null

I’m using sessions for the first time in Laravel and I’m trying to do a multiple step form, so I thought using sessions would be a smart move. however the following code returns a null value, what am I doing wrong?

JavaScript

Advertisement

Answer

In your controller you can save variable into session like

JavaScript

For checking your session variable in controller

JavaScript

For deleting your session variable in controller

JavaScript

For checking your session variable if it exists in blade and printing it out

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