F
Filament12mo ago
Jon

If I want to create panels for Users or Groups to edit their settings, is that a multitenant setup

part of my site needs front end management that allows users and or groups to manage settings specific to their profile. I figured a user and group panel might be a good way to do this, but should i be looking at multi tenant setups, or is there a better way to handle this? Also I created a vendor panel as well then set up the access as "
public function canAccessPanel(Panel $panel): bool
{
if ($panel->getId() === 'admin') {
return auth()->check()
&& auth()->user()->hasRole([
'admin', 'super-admin',
]);
}
if ($panel->getId() === 'vendor') {
return true;
}

return true;
}
public function canAccessPanel(Panel $panel): bool
{
if ($panel->getId() === 'admin') {
return auth()->check()
&& auth()->user()->hasRole([
'admin', 'super-admin',
]);
}
if ($panel->getId() === 'vendor') {
return true;
}

return true;
}
but every panel but vendor allows me to access it. Vendor panel is blocking access. No idea why. if the path is simply /vendor is their a route conflict maybe?
3 Replies
DrByte
DrByte12mo ago
Are you sure that the vendor panel isn't blocking it for another reason? Perhaps something else related to login/auth/guard/middleware settings? What kind of "block" is occurring? What error response are you getting?
Jon
JonOP12mo ago
well i just created 3 panels back to back, no other changes, so im not sure why 2 would work and one doesnt. "You don't have permission to access /vendor/ on this server."
DrByte
DrByte12mo ago
You created the canAccessPanel() method, but did you also mark the class as implements FilamentUser? I know that some of the panel features actually check whether the User model is implementing the contract. https://filamentphp.com/docs/3.x/panels/users#authorizing-access-to-the-panel
Want results from more Discord servers?
Add your server