Login auth check if user is admin
Hi, I added a bool value "is_admin" to the users to check, if the user is allowed to login to the backend.
Now, I want to integrate the check, but I don't know how I should do that.
Why? I want to use the users table to interact with user values in the frontend. some users are admins and should be able to login to the backend. It might be possible to remove admin-status of several users or add the admin status.
Solution:Jump to solution
```
public function canAccessPanel(Panel $panel): bool
{
return $this->is_admin;
}...
9 Replies
when you say "Allowed to login to backend" you mean if you allow them access to Filament Panel?
Isn't it so that every user in the user table with password will be allowed to login to filament backend?
yes and you can decide which one can and which one can not based on any logic you want
on the User model implement FilamentUser
and implement the method
in your case you can do
Solution
ohhh well, I will try this out. My coding skills are not the best. I am still learning laravel and filament π
no worries
thank you! π
public function canAccessPanel(Panel $panel): bool { return $this->is_admin; }