Jika anda mengalami masalah 403 Forbidden error ketika deploy projek Filamentphp ke server production, pastikan anda memasukkan kod berikut didalam User.php model
<?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();
}
}
Pastikan anda teleh memasukkan method function canAccessPanel(). Anda boleh memasukkan sebarang logik pada function ini atau anda boleh sekadar return true <?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 true;
}
}
Anda juga boleh rujuk https://tech.izoolz.com/2024/07/filamentphp-masalah-login-selepas.html