It should work.
Don't you have any middleware or other code that could initialize the session ?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi there!
I have created a page with a simple form view of containing mobile number input. After submitting the form I have put that mobile number into a session and tried to render back to same view file with custom flash message. Here I can able to see the message, but the mobile number session got null always.
// session(['verify_mobile' => $request->mobile]); // Tried this way alos
// dd(session('verify_mobile'));
Session::put('verify_mobile', $request->mobile);
// dd(Session::get('verify_mobile')); // Here I can able to see the session value correctly
redirect()->back()->with('message', 'Mobile number stored..!');
After redirect back to same page leads me into null for the same session variable
<p>Your Mobile Number : {{ Session::get('verify_mobile') }} </p>
Don't get why, the above Session::get('verify_mobile') always returns null
Please or to participate in this conversation.