Admin Model instead of User model
Hi everyone,
I’ve just migrated my project from Filament v2 to v3 and I’m encountering an issue with authentication. Previously, I was using the FilamentUser trait on my custom Admin model, and everything worked fine. However, after the upgrade, it seems Filament is now defaulting to the User model for login.
In my application, I have separate tables for users and admins, and I need Filament to authenticate using the Admin model instead of User.
What’s the recommended approach to achieve this in Filament v3?
Thanks in advance!
17 Replies
So like:
https://medium.com/@josephajibodu/change-laravel-authentication-model-for-filamentphp-3-b69fa1560cb2
Medium
Change Laravel Authentication Model for FilamentPHP 3
I was developing an e-commerce platform where I wanted to separate the customers from the website administrators for various reasons.
I've added ->authGuard('admin') in the AdminPanelProvider.php. I have the admin guard in auth.php
That's not working? Did you try clearing the config?
Any customisation to the Login class?
It is working now with this line, the only problem I have now is that my styles are not working on the server, and on local are working only if I run yarn dev.
are you running npm run build on prod?
i am running it in my yml before the deployment.
your yml? Usually the assets built at not committed in git. So deploying without running the build would mean missing assets
this is a part from my yml:
i have the assets in public/build
If you inspect the browser is it trying to load the assets?

Seems ok to me what type of styles are not loading?


Yeah not sure what's going on that, compare the theme size to your theme size?
this is my local when i am running yarn dev and everything is working fine

notice your theme is 132kb.... opposed to prod is 13....
So it's not finding the vendor folders or the paths I suspect? Run it manually on the server and see what it says.
Unfortunately I cannot run build on the server
Solution
The purge was the problem. Thank you for your time.