Please make sure you have the admin role.
public function canAccessPanel(Panel $panel): bool
{
dd($this->hasRole('admin'));
}
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I'm facing the issue /admin show 403 when deploy to my digital ocean server .It work well in local.
This is my User Model
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail; use Filament\Panel; use Laravel\Sanctum\HasApiTokens; use Spatie\Permission\Traits\HasRoles; use Illuminate\Notifications\Notifiable; use Filament\Models\Contracts\FilamentUser; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable implements FilamentUser { use HasFactory, Notifiable, HasRoles, HasApiTokens;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'name',
'phone',
'password',
'balance',
'parent_id'
];
/**
* The attributes that should be hidden for serialization.
*
* @var array<int, string>
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'email_verified_at' => 'datetime',
'password' => 'hashed',
];
}
public function canAccessPanel(Panel $panel): bool
{
return $this->hasRole('admin');
}
}
Please or to participate in this conversation.