Well you can't do that with sessions, because it's a session. You should either store that value in the database and retrieve it using the authenticated user id or store a cookie as well. The session will be gone when you close the browser or when you server restarts. However the cookie will remain active on the users browser.
Mar 26, 2018
1
Level 1
Setting session when login from remember me cookie
On my LoginController, when user successfully authenticated I set some cookies :
/**
* The user has been authenticated.
*
* @param \Illuminate\Http\Request $request
* @param mixed $user
* @return mixed
*/
protected function authenticated(Request $request, $user)
{
$request->session()->put('my_session_var', $my_session_value);
// other things
return false;
}
However, when I login with remember me checked, and then I reopen the page the next day, i cannot access the 'my_session_var' session.
My question is where can I set a session variable when user are authenticated using "remember me" cookie?
Please or to participate in this conversation.