Enable/Disable Login method
Hi,
Does anybody have an idea about enabling or disabling login during the boot process? I think it's a bit tricky.
11 Replies
What boot process?
Service provider
I want to get data from the database and then enable or disable the login or register method.
There's no known way to disable login, you can use the Filaments components to create a custom Livewire component and display it
If you want to use Filament components to create a custom page which shows data, just use Livewire with it
Tuto1902
YouTube
Filament Tables with Livewire: Full Page Component! ✨
The great thing about Filament is that you don't have to use the Panel Builder. You can create a complete C.R.U.D. application using just one full-page Livewire component and the Filament Tables package. This video will show you how to do that, using a small example project.
https://github.com/tuto1902/livewire-medication-reminder
00:00 Intro
...
It's an old Arturo's vídeo, but still working fine, if you just want to display data using Filament
Some methods, like login/register or domains, cannot be used in the boot method; therefore, we can't make them dynamic
Can you provide more detail?
Well, what I would do is conditionally call the ->login() method in the AdminPanelServiceProvider. I don't know what kind of database data you need but you should have access to models and query builders at that point
I guess if you remove login(), it complains about route for login doesn't exist
Yep, tested here with filament panels (at least)
Oh, here's the official docs for guest access. So all you need to do now is prepare the widgets and authMiddleware arrays so you can append Authenticate::class and AccountWidget::class depending on the database data you are using
https://filamentphp.com/docs/3.x/panels/users#setting-up-guest-access-to-a-panel