Laravel session expiration applies to each session.
P粉547362845
P粉547362845 2023-07-23 17:17:09
0
2
422

Can we set expiration time for each session in Laravel?

If possible, how can we set the expiration time through the controller for each session we create? Thanks.

P粉547362845
P粉547362845

reply all(2)
P粉475126941

Please change SESSION_LIFETIME= (duration in minutes) to the value in the .env file.

P粉854119263

You can change the lifetime of the session globally by changing the lifetime value in the config/session.php file:

/*
|--------------------------------------------------------------------------
| Session Lifetime
|--------------------------------------------------------------------------
|
| Here you may specify the number of minutes that you wish the session
| to be allowed to remain idle before it expires. If you want them
| to immediately expire on the browser closing, set that option.
|
*/

'lifetime' => 4320,
'expire_on_close' => false,

Now, if you want to control the session lifetime for each user, you need to set this value before the user logs in.

You need to make the above changes in LoginController.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template