Hi, can I ask how will you handle your session if it expires I am using artisan auth, the problem is that when it expires the User object will get error I cannot access anymore the firstname and lastname which I display on top of menu. I want to show message box to let the user sign in again. how to do this ?
Is that possible to let the user inform first to show message or alert saying "You sesssion has expired you must logged in again" then click ok redirect to Login page ?
the client cannot know that the session has expired on the server.
There is a package called caffeine that pings the server in the background to keep the session going however this can needlessly tie up server resources.
@SaeedPrez, the problem with this is when the user for some reason has more than one tab open. One tab times out and closes the session. The other window that the user is working in is then timed out for apparently no reason.
@snapey indeed it's not a good solution, but it could be improved... maybe keep a timestamp of the users last "real" server request and the JS would send an ajax request to the server and check that timestamp before logging the user out.