@shan2590 not sure if I fully understand your question, but if you're using database driver for storing your session, you should find last_activity field in sessions table.
@sti3bas can't use DB. If the user logged and the user didn't do any click or enter (application in the idle period 30 min)
after 30 min application logout (if user try to access application).
is that enough ? do I need to check user session if expired then redirect login page?
@snapey , I saw your answers regarding SESSION_LIFETIME , set SESSION_LIFETIME = 30. is that enough ? Do I want to check it again if session expire or not and redirect like thing inside middleware?
Remember that session IS NOT CHECKED after the lifetime ends. It is checked when the user returns to the site and tries to continue. The framework does not find a valid session for the user so starts a new one.
@snapey I'm trying to change user logging session time to 30min. Within this 30min if the user didn't do anything to in the application the session will automatically destroy and the user will logout.