F
Filament2y ago
bree

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
krekas
krekas2y ago
use the same user to access filament just restrict access to the panel
cheesegrits
cheesegrits2y ago
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.
bree
breeOP2y ago
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
awcodes
awcodes2y ago
do not listen to anything ChatGPT says about Filament. It's model is 2 versions behind. 🙂 you're code is fine though.
bree
breeOP2y ago
but anyone can still access the panel
awcodes
awcodes2y ago
yes, but only on your machine when you go to production that method will kick in and block them.
bree
breeOP2y ago
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
awcodes
awcodes2y ago
even locally, it works for me if i return false for the method.
public function canAccessPanel(Panel $panel): bool
{
return false;
}
public function canAccessPanel(Panel $panel): bool
{
return false;
}
bree
breeOP2y ago
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?
awcodes
awcodes2y ago
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.
bree
breeOP2y ago
okay, i'll do that, thanks!
PabloZagni
PabloZagni15mo ago
Filament
Companies by Andrew Wallo - Filament
A comprehensive multi-tenant authentication and authorization solution designed for Filament, with a focus on company-based tenancy.

Did you find this page helpful?