In the AdminPanelProvider i want only admin can access

48 Views Asked by At
public function panel(Panel $panel): Panel
  {
    return $panel
    ->resources([
        config('filament-logger.activity_resource')
    ])
  }

I want to hide that resources from all user types except my admin.

1

There are 1 best solutions below

0
ericmp On

https://filamentphp.com/docs/3.x/panels/installation#allowing-users-to-access-a-panel

By default, all User models can access Filament locally. However, when deploying to production, you must update your App\Models\User.php to implement the FilamentUser contract — ensuring that only the correct users can access your panel:

public function canAccessPanel(Panel $panel): bool
{
    return str_ends_with($this->email, '@yourdomain.com') && $this->hasVerifiedEmail();
}