Cannot load routes if path('') is empty

I'm new to filament, so maybe I'm doing something wrong, but in a completely fresh installation of Laravel (just plain Laravel, not Fortify or other frameworks), and a fresh installation of filament, when I change the path from path('dashboard') to path('') in DashboardPanelProvider, filament cannot charge the routes of the pannel once logged in. Route [filament.dashboard.pages.dashboard] not defined. Tried to clear cache (both Filament and browser)
Solution:
okay! I found the error after trying a lot of different things! I write the solution here just in case it helps someone in the future. As this is a new installation of Laravel, I forgot to remove the welcome route that was on path /, so this was the thing causing the error.
Jump to solution
13 Replies
toeknee
toeknee2w ago
Did you clear the cache afterwards?
toeknee
toeknee2w ago
It can be benefical to scope the routes to the domain: ->domain('admin.example.com'); https://filamentphp.com/docs/3.x/panels/configuration#setting-a-domain
Ophan
OphanOP2w ago
I already have the routes under a domain ->domain('dashboard.localhost.test') in my case, that's why I'm using the ->path(''). I tried everything cache-related.
toeknee
toeknee2w ago
so I have 3 panels and one without the path. I removed the path completely in my scenario so ->default() ->id('app') ->domain( config('app.url') ) It could be you have set default on multiple panels?
Ophan
OphanOP2w ago
I only have one panel, is a fresh installation of Laravel and Filament. I just installed Laravel, just installed Fillament with an id of "dashboard", then I created a user from the console, I tried the route localhost.test/dashboard/login with success, and then I changed the path('') from path('dashboard') to path(''). After this, I added the domain('dashboard.localhost.test'), but this last step didn't matter, because the non-existing view problem appeared since I let the path blank. btw return $panel ->default() ->id('dashboard') ->path('') ->domain(config('dashboard_domain')) // Subdomain
toeknee
toeknee2w ago
then did you run php artisan route:clear ?
Ophan
OphanOP2w ago
just run it again, just in case, same problem Symfony\Component\Routing\Exception\RouteNotFoundException Route [filament.dashboard.pages.dashboard] not defined.
toeknee
toeknee2w ago
Not making much sense... I did have it once but that's when I was calling the route directly
Ophan
OphanOP2w ago
Yeah, didn't make much sense, that's why I was thinking about missing some steps or points as I'm new with Filament and this is the first time I use it. But after reading all the documentation and being sure to clear all cache, I sent this message here.
toeknee
toeknee2w ago
Try removing the path if you set the domain, I have a feeling that was the issue so
->default()
->id('dashboard')
->domain(config('dashboard_domain')) // Subdomain
->default()
->id('dashboard')
->domain(config('dashboard_domain')) // Subdomain
Solution
Ophan
Ophan2w ago
okay! I found the error after trying a lot of different things! I write the solution here just in case it helps someone in the future. As this is a new installation of Laravel, I forgot to remove the welcome route that was on path /, so this was the thing causing the error.
Ophan
OphanOP2w ago
So in the end, it was a route collision conflict with the Laravel welcome route, which to be honest I forgot about it completely. My bad. Thanks for the help!
toeknee
toeknee2w ago
Great find, that was my issue too now I remember hehe

Did you find this page helpful?