On Production
To deploy this project to Production, we follow all the Laravel recommendations, and a few more steps need to be added, as this app is developed with Filament.
Error 403
To avoid the 403 error when accessing the admin in production, follow these steps:
⚠️ Create a strong password for your app. When deploying your Filament administration panel in a non-local environment and receiving 403 Forbidden errors when trying to access it, you may have forgotten to configure 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 Filament Documentation at: Filament Documentation