Route [login] not defined.
Hello,
I get this error whenever session expire and to login again. Any help. Thanks in advance
3 Replies
I think this is solved since you asked in other threads, but for completeness I'll copy here.
Define a route with the name "login" that redirects to Filament login
I have 2 panels with separate logins and this route fix will not work
I think because at the point of checking the request it is already /laravel/login and not the original route.
To get to the cause of the issue there are 2 places I've found where laravel references the login route.
1. In authenticate middleware. So that's a simple change in app/Http/Middleware/Authenticate.php
2. In the unauthenticated exception. So add an override in app/Exceptions/Handler.php
This means the login route is not called any more π
I had the same problem and solved it by two methods: 1- is to extend the
use Filament\Http\Middleware\Authenticate
and override the redirectTo()
method and update 1 ->authMiddleware([
Authenticate::class,
]);
in the panel provider
2- to edit the protected function redirectTo(Request $request): ?string
{
return $request->expectsJson() ? null : route('filament.app.auth.login');
}
on App\Http\Middleware` this way you handeled both Middlewares