Filament
Add a separate /admin panel. Filament uses Livewire; it does not replace the Svelte/Inertia frontend.
These notes target Filament 5 (checked against v5.8.1) and the setup guide's split-name model with Spatie roles. Run commands in the Laravel application.
Install
Filament 5.8.1 requires PHP 8.2+, Laravel 11.28/12/13, Livewire 4.1+, and PHP's intl extension. Composer installs Livewire; keep the existing Svelte/Vite setup for this separate panel.
bash
composer require "filament/filament:^5.0"
php artisan filament:install --panelsUse admin as the panel ID. Confirm App\Providers\Filament\AdminPanelProvider::class is registered in bootstrap/providers.php.
Do not run filament:install --scaffold against the existing frontend; it can overwrite application files.
Add the Agent Skill
The setup guide already installs Laravel Boost. After installing Filament, rerun:
bash
php artisan boost:installSelect Agent Skills, then filament/filament (skills). Confirm your agent's skills directory contains filament-development/SKILL.md. See Filament's AI guide.
User Model
File: app/Models/User.php (additions)
Add FilamentUser and HasName to the existing implements list. Keep PasskeyUser, the auth traits, HasRoles, and the split-name methods.
php
use Filament\Models\Contracts\FilamentUser;
use Filament\Models\Contracts\HasName;
use Filament\Panel;
// Update the existing declaration; keep its attributes and imports.
class User extends Authenticatable implements PasskeyUser, FilamentUser, HasName
{
// Keep existing traits, properties, and methods.
public function canAccessPanel(Panel $panel): bool
{
return $this->hasRole('admin') && $this->hasVerifiedEmail();
}
public function getFilamentName(): string
{
return "{$this->first_name} {$this->last_name}";
}
}HasName avoids Filament reading the removed name column. Skip make:filament-user for the same reason: it creates users with a single name field.
Use the local UserSeeder for development. Provision a separate verified admin for production; do not deploy the sample accounts. The panel check requires email_verified_at, even if the application's model does not implement MustVerifyEmail.
Filament's login does not use Fortify's authentication pipeline: keeping its traits does not enable passkey login or enforce Fortify 2FA in the panel. Configure Filament MFA or integrate the existing authentication flow before relying on 2FA. The default web guard shares sessions with the frontend; test both entry points.
Panel Configuration
File: app/Providers/Filament/AdminPanelProvider.php
Change only the relevant calls in the existing panel() chain; keep login, middleware, discovery, pages, and widgets.
php
use Filament\Support\Colors\Color;
// In the existing $panel chain:
->path('admin')
->brandName(config('app.name').' Admin')
->colors(['primary' => Color::Indigo])FILAMENT_PATH and FILAMENT_DOMAIN do nothing unless the provider explicitly reads them. Use path() and, if needed, domain() here. Neither setting disables the panel.
Generate Resources
For an existing model and migrated table:
bash
php artisan make:filament-resource Post --generateReview generated fields before exposing the resource. Panel access is not record-level authorization; add the model policy for viewAny, view, create, update, and delete. Cover deleteAny for bulk deletion: it does not check delete for each record by default. Missing policies or policy methods allow access by default.
Verify
bash
php artisan route:list --path=admin
php artisan test --compact
npm run build- Confirm a verified admin can sign in and sees the full name.
- Confirm a regular user and an unverified admin cannot enter the panel.
- Test resource policies directly for allowed and denied users. Exercise denied resource URLs/actions with a verified admin restricted by the policy; a non-admin is rejected at the panel gate before resource checks.
- Recheck the Svelte frontend after installation.
Production
Keep the installer's @php artisan filament:upgrade hook in Composer's post-autoload-dump scripts so published assets stay current. If deployment skips Composer scripts, run php artisan filament:upgrade explicitly.
Refresh Filament caches during deployment, after updating code:
bash
php artisan filament:optimize-clear
php artisan filament:optimize