Integrate filament with jetstream
Hello, how do I use an existing jetstream login/user to login to filament for the admin? I installed filament but can't create a filament user because in jetstream, I made a "username" field mandatory so when I use the command to make a filament user it says that the username field is empty, it also says that the email address is taken because it's registered with the jetstream login. Basically, how do I set up filament for the admin section of my jetstream-based app? Thanks
12 Replies
use the same user to access filament
just restrict access to the panel
The Filament command for making a user is just there as a convenience. It doesn't do anything special, just adds a user to your users table.
how do i restrict access to the panel for just that user? right now, any user can login. thanks
it says when running locally all users can access the panel but can i edit the user model and test it out locally
i did
public function canAccessPanel(Panel $panel): bool
{
$adminEmail = '[email protected]';
return $this->email === $adminEmail;
}
but still anyone can access the panel, not sure what else to do, chatgpt says i need to add an is_admin flag to the db and create middleware for the routes
do not listen to anything ChatGPT says about Filament. It's model is 2 versions behind. π
you're code is fine though.
but anyone can still access the panel
yes, but only on your machine
when you go to production that method will kick in and block them.
are you sure? how can i set it up locally though and test? my current url isnt localhost its something.test, not sure if that matters at all, but it hosted locally for now, just not at localhost
even locally, it works for me if i return false for the method.
oh okay thanks
that was a lot simpler than i thought it would be
i still have to set it up where the panel shows all of the users and their info and allows me to delete/edit a user, how do i do that?
For that you're going to need to go through the docs and learn how the panel builder works. That's way to much for us to "tell" you how to do on here.
It's not difficult or a lot of work, but you will need to learn that for yourself, then come back and ask specific questions if you get stuck.
okay, i'll do that, thanks!
Filament
Companies by Andrew Wallo - Filament
A comprehensive multi-tenant authentication and authorization solution designed for Filament, with a focus on company-based tenancy.