USe different user model in filament.php
Hi guys, I have a different user model for filament, how can I change it in config? because I writed this but without success (filament.php):
'users' => [
'model' => \App\Models\Filament\User::class,
],
Thanks11 Replies
If you mean for authentication, then you should change the model in the auth config (for the guard)
so is it possible to use a different model in a different panel, example AdminPanel = User model... and Memberspanel => Members Model ?
It is. Just use 2 different guards for that.
Thx π
i want to separate normal users from admin, that's why i created a new model, is it a good practice? thaks
You can go this route. But it requires two auth guards. You could also add a
role
column for your model and then check the role in canAccessPanel()
I'm looking to do the same but continue using the existing authentication. I have a customized user class that is augmented only with first and last name (string) values. Does this still require the auth guard change?
What's the relevant change that's different from the default? π€ User model is already the default auth model for Laravel.
in my case the new model has a differing namespace other than App\Models\
Solution
You should adjust that in your Laravel's auth config then.
ah - that was it - thanks!