F
Filamentβ€’5mo ago
Patabugen

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
Dennis Koch
Dennis Kochβ€’5mo ago
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.
Patabugen
PatabugenOPβ€’5mo ago
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.
Dennis Koch
Dennis Kochβ€’5mo ago
Existing Auth
I guess you have ->login() on that panel?
but I then just got my regular page
Probably because that one is at /? Create a resource or page and check that URL
Patabugen
PatabugenOPβ€’5mo ago
Ah, 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 !
Dennis Koch
Dennis Kochβ€’5mo ago
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
Patabugen
PatabugenOPβ€’5mo ago
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
Dennis Koch
Dennis Kochβ€’5mo ago
implements FilamentUser on your Auth model
Patabugen
PatabugenOPβ€’5mo ago
Which I think is related to this comment "you need to avoid using components which expect a signed-in user " ahhh!
Dennis Koch
Dennis Kochβ€’5mo ago
All clear?
Patabugen
PatabugenOPβ€’5mo ago
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
Patabugen
PatabugenOPβ€’5mo ago
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 πŸ™‚
Dennis Koch
Dennis Kochβ€’5mo ago
Great to hear. Hope you enjoy the ride
Want results from more Discord servers?
Add your server