Module 6: Filament Admin

Rapid Admin Panel Development with TALL Stack

What is Filament?

Filament is a collection of full-stack components for building admin panels, forms, and tables. It is built on top of the TALL stack (Tailwind, Alpine, Laravel, Livewire).

composer require filament/filament:"^3.2" -W
php artisan filament:install --panels

Resources

Resources are static classes that describe how to interact with an Eloquent model.

php artisan make:filament-resource Customer

This creates a CustomerResource class with methods for form() and table().

Building Forms

Define your form schema using a fluent PHP API.

public static function form(Form $form): Form
{
    return $form
        ->schema([
            TextInput::make('name')
                ->required()
                ->maxLength(255),
            Select::make('status')
                ->options([
                    'draft' => 'Draft',
                    'published' => 'Published',
                ]),
            RichEditor::make('content'),
        ]);
}

Building Tables

Define your data table with columns, filters, and actions.

public static function table(Table $table): Table
{
    return $table
        ->columns([
            TextColumn::make('name')->searchable(),
            TextColumn::make('email'),
            BadgeColumn::make('status')
                ->colors([
                    'danger' => 'draft',
                    'success' => 'published',
                ]),
        ])
        ->filters([
            SelectFilter::make('status')
                ->options([
                    'draft' => 'Draft',
                    'published' => 'Published',
                ]),
        ])
        ->actions([
            Tables\Actions\EditAction::make(),
        ]);
}

Widgets & Dashboards

Create stats widgets for your dashboard.

php artisan make:filament-widget StatsOverview --stats-overview
protected function getStats(): array
{
    return [
        Stat::make('Unique views', '192.1k')
            ->description('32k increase')
            ->descriptionIcon('heroicon-m-arrow-trending-up')
            ->color('success'),
        Stat::make('Bounce rate', '21%'),
    ];
}