Route [login] not defined

please help! I have two guard and I use admin guard for Filament admin, and I use export action in header or bluck action, after success, in notification when click to open download file like .csv, redirect me to Route [login] not defined. how I can solve it?
No description
6 Replies
toeknee
toeknee2mo ago
Check your routes/web.php I suspect you have a welcome page at / still
Mamoun Abu Salah
Mamoun Abu SalahOP2mo ago
no, I add defualt guard in serivce proverider to admin guard add this in your AppServiceProvider register method. config([ 'auth.defaults.guard' => 'admin', ]);
toeknee
toeknee2mo ago
Tht's a guard. what is in your web.php?
Mamoun Abu Salah
Mamoun Abu SalahOP2mo ago
I don't have any routes in web.php to download file, I think that is a temporary solution, there is a depth problem that needs to be solved.
Azad Furkan ŞAKAR
The main problem here is that I had the same problem and when I went deep into the files I saw that at some point it was controlling the web guard in a middleware (I don't remember which file it was in right now), which causes the problem mentioned when using a different guard. I solved the problem by overriding the guard to update to “admin” if the request is coming from filament. Other than that, I haven't seen any solution or suggestion so far. For this, I wrote a function that checks if there is a “filament” in the request and added it to the register in the AppServiceProvider file as;
if ($this->isRequestFromFilament()) {
config([
'auth.defaults.guard' => 'admin',
]);
}
if ($this->isRequestFromFilament()) {
config([
'auth.defaults.guard' => 'admin',
]);
}
Mohamed Ayaou
Mohamed Ayaou2mo ago
It's just that the laravel default login route is /login but with filament we have only {panel}/login so just add a route for login to redirect to the {panel}/login, e.g in the web.php:
foreach (filament()->getPanels() as $panel) {
Route::redirect('/login', $panel->getPath().'/login')->name('login');
}
foreach (filament()->getPanels() as $panel) {
Route::redirect('/login', $panel->getPath().'/login')->name('login');
}
or just:
Route::redirect('/login', '/admin/login')->name('login');
Route::redirect('/login', '/admin/login')->name('login');
if you have only one panel.

Did you find this page helpful?