If you've deployed your Filament admin panel to a non-local environment, and you're receiving 403 Forbidden
errors when you try to access it, it's likely that you've forgotten to set up your User
model to access Filament.
You must implement the FilamentUser
contract:
<?php namespace App\Models; use Filament\Models\Contracts\FilamentUser;use Filament\Panel;use Illuminate\Foundation\Auth\User as Authenticatable; class User extends Authenticatable implements FilamentUser{ // ... public function canAccessPanel(Panel $panel): bool { return str_ends_with($this->email, '@yourdomain.com') && $this->hasVerifiedEmail(); }}
The canAccessPanel()
method returns true
or false
depending on whether the user is allowed to access the $panel
. In this example, we check if the user's email ends with @yourdomain.com
and if they have verified their email address.
You can find this information in the documentation.
Dan is a full-stack developer from the Cardiff, UK. He co-created Filament, and continues to lead development of the project. He works for Kirschbaum, a web development agency.