F
Filamentβ€’10mo ago
vitali

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, ], Thanks
Solution:
You should adjust that in your Laravel's auth config then.
Jump to solution
11 Replies
Dennis Koch
Dennis Kochβ€’10mo ago
If you mean for authentication, then you should change the model in the auth config (for the guard)
jouni.i
jouni.iβ€’10mo ago
so is it possible to use a different model in a different panel, example AdminPanel = User model... and Memberspanel => Members Model ?
Dennis Koch
Dennis Kochβ€’10mo ago
It is. Just use 2 different guards for that.
jouni.i
jouni.iβ€’10mo ago
Thx πŸ™‚
vitali
vitaliβ€’10mo ago
i want to separate normal users from admin, that's why i created a new model, is it a good practice? thaks
Dennis Koch
Dennis Kochβ€’10mo ago
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()
islandnuge
islandnugeβ€’10mo ago
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?
Dennis Koch
Dennis Kochβ€’10mo ago
What's the relevant change that's different from the default? πŸ€” User model is already the default auth model for Laravel.
islandnuge
islandnugeβ€’10mo ago
in my case the new model has a differing namespace other than App\Models\
Solution
Dennis Koch
Dennis Kochβ€’10mo ago
You should adjust that in your Laravel's auth config then.
islandnuge
islandnugeβ€’10mo ago
ah - that was it - thanks!
Want results from more Discord servers?
Add your server