Summer Sale! All accounts are 50% off this week.

aneeshsudhakaran-git's avatar

How we can customize session expired URL from login to another URL?

I'm using laravel11 with breeze. and implemented multiauthentication with admin guard. All are working fine. but when session expired from any admin page it will automatically return to login page. how does it could be resolved. thanks in advance.

0 likes
1 reply
rodrigo.pedra's avatar

Take a look at the "Rendering Exception" section from the docs:

https://laravel.com/docs/11.x/errors#rendering-exceptions

The idea is that you can hook to an exception before Laravel handles it and customize its behavior.

In your case, the exception you want to "trap" is the Illuminate\Auth\AuthenticationException.

Add a hook for his exception and return a redirect, or a view as you desire.

1 like

Please or to participate in this conversation.