owner record
hi . i want to ask. how to customize the heading of login form based on panel route ? currenly im working on two panel . admin and application .
i try to overide at the vendor file like this but it did'nt work . any ideas ?
11 Replies
I wouldn't do it in vendor, it should be in the Login class that would override the Vendor.
Also, I think the route names are not with slashes like "application/login" but with dots, "application.login". Do the
dd($routeName)
to check.Create new filament-page that extends Filament Login like below and used that login page in panel and override getHeading():
Do this approach for all of your panel.
I see. So should i make a custom page and extends to login class?
I see . But how to set the heading based on panel route ? Can you show example ? My code in the pic didnt work
Yes that's how I would do that. I've added to my to-do list to write a quick tutorial but not sure when, in a couple of days
That would be nice . A lot of technique currently im working on Project . I will refer to your website and YouTube Channel. Thanks for sharing.
If you don't use custom login then you have to do my example approach in each and every panel. and on every panel you override default login like my example
Thanks will wait for this one.. One more thing, I create a custom login that extend default login but I have to remove that
canAccessPanel
checking (https://github.com/filamentphp/filament/blob/3.x/packages/panels/src/Pages/Auth/Login.php#L81) otherwise it cannot redirect to different panel (except default). Hope you consider this one as well@Vp I've just recreated the same thing you did in my project, and it worked well without doing anything with canAccessPanel
app/Filament/Auth/AdminLogin.php:
app/Filament/Auth/StudentLogin.php:
app/Providers/Filament/AdminPanelProvider.php:
app/Providers/Filament/StudentPanelProvider.php:
Hi @PovilasKorop sorry for not explaining well, my last message was different topic, throw in this threat just in case you'd want to experiment as well. I create a full livewire components, I remove
->login()
from my panels, cause I am using my livewire as login (I provide only one login page). I check it like below():
If I didn't remove if ()
from above then cannot login on other paneloh, you're using your own livewire as login... then yeah it may be a different logic and a different case, sorry don't want to dive into that one deeper
ok published it as a free snippet on our Filament Examples, but it's basically the same as @Vp suggested: https://filamentexamples.com/project/multi-panels-customize-login
Wow . Thank you so much . I dont expect this fast update from you. God bless.
Okay noted . Will try this one as well. Thanks for the sharing and ideas