Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ArchStanton's avatar

laravel 5.2 session not saving

I save a session in my controller

Session::put('name', 'ross');
Session::save();

 return redirect('step2');

Then is step2 blade template I get a null session

it is {{  dd(Session::all())}}

What could be going wrong? I am sure I did it this way in laravel 4?

0 likes
4 replies
ArchStanton's avatar

@ tykus_ikus

Just wrapped all my rotues in a middleware group, it is just or is this really annoying this web middleware thing.

Route::group(['middleware' => ['web']], function () {

tykus's avatar

Does it work for you now??

Concerning the inconvenience, it's something that I need to think about once per project and then I move on... if you are creating an API, then it makes sense not to care about Sessions and Cookies, but I do care about request throttling, so it is convenient to have separated middleware groups depending on the application

peterlee's avatar

@tykus Thank you for your advice, and it helps me out to solve the problem also.

but still, I have another problem that when I store session from android application, it does not store any session, unlike accessed through from postman.

storing session from postman works fine.

Please or to participate in this conversation.