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

elqouent10's avatar

Session Data Not Updating on Redirect on 5.1

I am having trouble with Sessions with Laravel 5.1.31. The session data doesn't appear to show up unless I manually hit refresh. When the page redirects, it returns a null when I attempt to use Session::get().

I have one controller method doing a redirect to another route.

public function load(Request $request) {

        $randomString = '7378b31fb942292ac0a7f66f925b2f8bbdf7f85e';

        Session::put('app.active.'.$randomString , 'fakedata');

        return redirect()->route('display', $randomString );
}

Redirects to...

public function display($string) {
   
    dd(Session::get('app.active.'.$string));  
    //When I redirect to this page, this is null, but when I F5, it displays the 'fakedata'. The session only works after I hit F5? Why is this?

}

0 likes
0 replies

Please or to participate in this conversation.