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

rawrkats's avatar

[5.4] my new session data is not saving through redirect.

Scenario: User logs in, after logging in, user is directed to and submits another form, form values get stored in session, user is then forwarded to a dashboard.

I'm getting my user logged in, but after the second form submission, my session variables are not being stored and carried over to the final destination ( or anywhere else throughout the app where needed )

I'm not sure if its entirely relevant, but the place i'm setting the session vars that aren't carrying over is in a route::post Controller method

routes.php:
    Route::post('/setlocation','LocationController@setlocation');
LocationController.php:
public function setlocation(\Request $request)
    {
        $location = \App\Location::find($request->input('location_id'));
        $clover = new \App\Clover($location->merchant_id);
        \Session::put('clover',$clover);
       
        return redirect('/')->with('status','Location Set!');

    }

neither session('clover') or session('status') get set on the Index page.

0 likes
0 replies

Please or to participate in this conversation.