I'm busy implementing sessions into a Laravel 8 app (not using the Breeze template) and I don't quite understand how the timeout works
I have a controller to create a very simple session on login
class LoginController extends Controller {
public function authenticate(Request $request) {
// create the most basic session I can
$request->session()->put('exists', 'Y');
return redirect()->route('welcome');
}
}
And the middleware to test it
class SessionCheck {
public function handle(Request $request, Closure $next) {
if (! session()->has('exists')) {
return redirect('login');
} else {
return $next($request);
}
}
}
I see that there's a variable in the .env
for SESSION_LIFETIME=60
but what does it do? It doesn't seem to be emptying out the session vars, how can the timeout be checked?
question from:
https://stackoverflow.com/questions/65651857/laravel-8-timeout-a-manually-created-session 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…