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

sourcy's avatar

session store login variables

I've made a custom login using laravel 5.5. After a successful login, method authenticated() is called which I added to LoginController. In authenticated() I try to store extra login request variables in the session using session(['foo' => 'bar']);

However these added session variables are immediately lost after the redirection (in LoginController I use the default $redirectTo = '/home';)

What should I do in order to keep the variables in the session? I have read in other places folowing solutions, which don't work in L5.5

  • use $request->session()->save()
  • change the cookie name in session.php to a fixed name like 'cookie' => "mysession"

I use file session driver.

0 likes
0 replies

Please or to participate in this conversation.