Laravel Inactivity time setting

707 0 0 0

Last Updated : 2024-04-25 04:52:43

When user logged-in and remains inactive , they can be logged out after a period of time . so this snippet will teach you this

you can change the time period for an idle session to expire in the /app/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' => env('SESSION_LIFETIME', 15), // set inactivity time in env file at SESSION_LIFETIME first and determine default time here so replace 15 to what minutes you want

'expire_on_close' => false, //if you set this to true , the session will expire when browser is closed

Mahmoud Anwar

Mahmoud Anwar

Back End Developer with a passion for developing innovative web applications that expedite the efficiency and effectiveness of organizational success. Well-versed in technology and writing code to create systems that are reliable and user-friendly. Also has the proven ability to motivate, educate, and collaborate effectively to build web applications and effectively track changes. Confident communicator, strategic thinker, and innovative creator to develop software that is customized to meet a company’s organizational needs, highlight their core competencies, and further their success.