Progressively adding Filament to an existing admin panel
I'd like to progressively add Filament Panels to an existing admin panel, can anyone share any advice or tips?
Specifically can anyone point me in the right direction for these:
1. Use the existing login/auth UI (instead of Filaments one)
2. Run Filament without a URL prefix (e.g. no
/admin
but just /
)
3. Leave the existing pages as-is (they're traditional Laravel/Controller/Blade layouts).
Or let me know if a reason they're not possible.
I'd like to keep the magic of Filament, with a view that one day we won't have the legacy stuff - so I think I don't want to use the Table Builder/etc separately - because I miss out on some of the magic.12 Replies
Use the existing login/auth UI (instead of Filaments one)What's the issue you are facing? Filament should work with your custom login.
Run Filament without a URL prefix (e.g. no /admin but just /)Again: What issue are you facing? You can just adjust the
->path('/')
. Just make sure you don't get collission.
Leave the existing pages as-is (they're traditional Laravel/Controller/Blade layouts).Filament won't touch them.
Thanks @Dennis !
Existing Auth
I've setup a panel on the default '/admin' URL. If I login to my app, then go to /admin I get the login screen.
Without a URL
I tried making it empty, or putting '/' but I then just got my regular page (not the login page I got above).
If that should work though, I'll have more of a play before coming back to you.
Leave the existing pages
Awesome! Sounds like I need to address the two things above, and this one will become clear.
Existing AuthI guess you have
->login()
on that panel?
but I then just got my regular pageProbably because that one is at
/
? Create a resource or page and check that URLAh, wonderful! That login suggestion led me to this: https://filamentphp.com/docs/3.x/panels/users#setting-up-guest-access-to-a-panel
which I'll follow for now.
Superb kick-start, thanks @Dennis Koch !
You probably don't want "guest" access if you already have a login
Just removing
->login()
should be enough. When trying to access the panel it will redirect you to the route with the name login
I was just thinking, I might need to make my own Authenticate Filament Middleware
I'm looking into this error at the moment:
Filament\FilamentManager::getUserName(): Return value must be of type string, null returned
implements FilamentUser
on your Auth modelWhich I think is related to this comment "you need to avoid using components which expect a signed-in user "
ahhh!
All clear?
I'm having some hiccoughs, but I'm going to work through this page bit by bit and will let you know if I get stuck. Thanks!
https://filamentphp.com/docs/3.x/panels/users#setting-up-guest-access-to-a-panel
But I'm also off until Monday morning in about 2 minutes, so will carry on then!
Thanks for your help last week Dennis, the integration has gone wondefully - and you got me off to a great start π
Great to hear. Hope you enjoy the ride