Skip to content

Laravel Filament tutorial: an admin panel for beginners

· The AYT team · 9 min read

Developer desk with two monitors, one showing code

Filament is a free Laravel package that builds an admin panel from PHP classes, without writing HTML or JavaScript. You install it with composer require filament/filament:"^5.0" and php artisan filament:install --panels, create a user with php artisan make:filament-user and open /admin. Then you add a "resource" for each model, with its form and table.

What Filament is

Filament is built on Livewire and Tailwind CSS. The panel it generates comes with sign-in, a menu, tables with search, sorting and pagination, forms with validation, notifications and dark mode. You only describe which fields each form has and which columns each table has.

It's typically used for internal tools: tracking customers and orders, a small CRM, managing a site's content, reports for a team.

The basic pieces:

  • the panel, an admin area with its own address, usually /admin;
  • the resource, which links an Eloquent model to its pages: list, create, edit;
  • the form (schema) and the table, each defined in its own class;
  • widgets, blocks with figures or charts for the start page.

This tutorial uses Filament 5, released on 16 January 2026. What it adds over Filament 4 is Livewire 4 support; the features are the same, so tutorials for v4 mostly apply to v5 too.

Requirements

According to the Filament 5 documentation:

  • PHP 8.2 or newer;
  • Laravel 11.28 or newer, so it runs on Laravel 12 and 13;
  • Tailwind CSS 4.1 or newer, which matters when you build your own theme.

If your project is on Laravel 13, you already have PHP 8.3 or newer. Laravel's full requirements are in our article on Laravel 12 and 13 requirements.

Step 1: install the panel

If you're starting from scratch, create the project first, for example with composer create-project laravel/laravel panel, and set up the database in .env. Filament uses the users table from Laravel's default migrations, so run php artisan migrate first. Then, in the project folder:

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

The second command creates app/Providers/Filament/AdminPanelProvider.php, where the panel is configured: its address, colours, and which pages and resources it loads. The panel created this way answers at /admin; you can change the address there too, with ->path().

Step 2: the first user

php artisan make:filament-user

The command asks for a name, an email address and a password, and creates a row in the users table. Open http://localhost:8000/admin (or your project's address), sign in and you'll see the empty panel, with its menu and start page. Locally, any user in the table can sign in; in production access has to be granted explicitly, in step 9.

Step 3: a model and a migration

Say you want to keep track of customers. Create the model with its migration:

php artisan make:model Customer -m

In the migration created in database/migrations, add the columns:

Schema::create('customers', function (Blueprint $table) {
    $table->id();
    $table->string('name');
    $table->string('email')->unique();
    $table->string('phone')->nullable();
    $table->string('city')->nullable();
    $table->boolean('is_company')->default(false);
    $table->timestamps();
});

Run php artisan migrate. For Filament to save the form's fields, the model must allow them to be filled. The simplest way, in app/Models/Customer.php:

protected $fillable = ['name', 'email', 'phone', 'city', 'is_company'];

Step 4: the resource, with a generated form and table

php artisan make:filament-resource Customer --generate

With --generate, Filament reads the table's columns and writes the form and table for you. Without it, you get the same files, but with an empty form and table that you fill in yourself. The files land in app/Filament/Resources/Customers/:

  • CustomerResource.php, the resource's main class;
  • Pages/, the list, create and edit pages;
  • Schemas/CustomerForm.php, the form;
  • Tables/CustomersTable.php, the table.

Reload /admin: Customers appears in the menu, with a list, an add button and an edit form. The menu name comes from the model's name, and you can change it in the resource class.

Step 5: adjust the form

The generated form is a starting point. Open it and make it look the way you want:

use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Schemas\Schema;

public static function configure(Schema $schema): Schema
{
    return $schema
        ->components([
            TextInput::make('name')->required(),
            TextInput::make('email')->email()->required()->unique(ignoreRecord: true),
            TextInput::make('phone')->tel(),
            TextInput::make('city'),
            Toggle::make('is_company')->label('Company'),
        ]);
}

required(), email() and unique() are also validation rules: Filament checks the data before saving and shows errors next to the fields. ignoreRecord: true tells it that, when editing, the current customer's own address isn't a duplicate.

Step 6: search, sorting and filters in the table

In CustomersTable.php you choose the columns and what users can do with them:

use Filament\Actions\EditAction;
use Filament\Tables\Columns\IconColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Filters\TernaryFilter;
use Filament\Tables\Table;

public static function configure(Table $table): Table
{
    return $table
        ->columns([
            TextColumn::make('name')->searchable()->sortable(),
            TextColumn::make('email')->searchable(),
            TextColumn::make('city')->sortable(),
            IconColumn::make('is_company')->label('Company')->boolean(),
        ])
        ->filters([
            TernaryFilter::make('is_company')->label('Company'),
        ])
        ->recordActions([
            EditAction::make(),
        ]);
}

searchable() adds the column to the search box above the table, sortable() makes the header clickable, and the filter shows only companies or only individuals.

Step 7: a relationship, customers' orders

Real panels have related models. Say you add an Order model, with a customer_id column and a belongsTo relationship called customer() in the model. In the order form, the customer is picked from a list:

use Filament\Forms\Components\Select;

Select::make('customer_id')
    ->relationship(name: 'customer', titleAttribute: 'name')
    ->searchable()
    ->preload()
    ->required(),

Filament reads the customers through the relationship, shows their names and saves the ID. With searchable() you can search the list by name, which matters once you have hundreds of customers. In the orders table, TextColumn::make('customer.name') shows the customer's name instead of the ID, because Filament follows the relationship after the dot.

Step 8: a widget with figures on the start page

The panel's start page stays empty until you give it something to show. A stats widget is created with:

php artisan make:filament-widget StatsOverview --stats-overview

In the class created in app/Filament/Widgets/, return the figures you care about:

use App\Models\Customer;
use Filament\Widgets\StatsOverviewWidget\Stat;

protected function getStats(): array
{
    return [
        Stat::make('Customers', Customer::count()),
        Stat::make('Companies', Customer::where('is_company', true)->count()),
        Stat::make('New customers this month', Customer::where('created_at', '>=', now()->startOfMonth())->count()),
    ];
}

The panel generated by filament:install discovers the widgets in that folder on its own, so the new widget shows on the start page with no further setup.

The panel in your language and colours

Filament ships translations for its interface in many languages, Romanian included: buttons, validation messages, pagination. With APP_LOCALE=ro in .env, the panel speaks Romanian. You set your own field labels with ->label().

Change the colours and the name in the panel's corner in AdminPanelProvider, with ->colors(['primary' => Color::Amber]) and ->brandName('Your Company'). For bigger changes to the look, build your own theme with Tailwind.

Step 9: access in production

While the app runs locally (APP_ENV=local), Filament lets any user into the panel. In production it doesn't: the User model must implement FilamentUser and say who gets access. Without it, anyone who tries /admin gets a 403, you included.

use Filament\Models\Contracts\FilamentUser;
use Filament\Panel;

class User extends Authenticatable implements FilamentUser
{
    public function canAccessPanel(Panel $panel): bool
    {
        return str_ends_with($this->email, '@yourcompany.com') && $this->hasVerifiedEmail();
    }
}

You choose the condition: an email domain, an is_admin column, a role. If the panel still returns 403 after a deploy, the other possible causes are in our article on Laravel 403 Forbidden.

Step 10: the deploy

In your deploy script, after php artisan optimize, add:

php artisan filament:optimize

The command caches Filament's components and icons, which makes the panel faster. Filament's documentation recommends it for production and advises against using it while developing. To clear the cache, there's php artisan filament:optimize-clear.

Create the first user on the server with the same make:filament-user command. If you can't answer prompts (without SSH, for example), the command also accepts the --name, --email and --password options. Use a temporary password and change it after your first sign-in: turn on the profile page with ->profile() in AdminPanelProvider.

Common beginner problems

The resource doesn't show in the menu

If the model has a Policy, Filament respects it. The viewAny() method must return true for your user, or the resource won't appear in the menu.

A form field doesn't save

The field is missing from the model's $fillable, and Laravel silently ignores it. Add it to the list.

After a deploy, the panel has no styles

On install, Filament adds php artisan filament:upgrade to the post-autoload-dump scripts in composer.json, which copies its CSS and JavaScript into public. If you removed it, run php artisan filament:assets on every deploy. Also check that the server's public folder actually receives the copied files.

Changes to resources don't show in production

The components are cached by filament:optimize. The command must run on every deploy, after the new code is on the server.

When Filament isn't the right fit

Filament is built for the back office, for the people who manage data. For a site's public side, the part visitors see, you keep using Blade, Livewire or Inertia with your own design. And if your admin interface must look nothing like a panel with a menu, tables and forms, you'll spend more time working around Filament than using it.

Frequently asked questions

Is Filament free?

Yes, Filament is open source under the MIT licence. There are paid community plugins, but the panel itself costs nothing.

Filament or Laravel Nova?

Nova is the admin panel made by the Laravel team and is sold under a licence. Filament is free and has a large plugin community. For a new project, without a specific reason for Nova, Filament is the usual choice.

Do I need to know Livewire to use Filament?

Not to start. Resources, forms and tables are written in plain PHP with Filament's methods. Livewire matters when you build your own pages or components Filament doesn't have.

Can I have several panels?

Yes. A project can have, for example, /admin for the team and /app for customers, each with its own provider. canAccessPanel() receives the panel as a parameter, so you can grant different access to each.

Filament on AYT hosting

On AYT, a site set up with the Laravel Toolkit runs Composer on every deploy, so the Filament packages are installed on the server with the site's PHP. Add php artisan filament:optimize to the deploy script under Deployments, after php artisan optimize, and the cache is rebuilt with every release.

The Laravel Toolkit's Commands page, where you run artisan commands from the panel

Create the first user from the Commands page, which runs non-interactive artisan commands (up to 120 seconds), with make:filament-user and the --name, --email and --password options. The site's Security page also runs a composer audit report, useful because an admin panel brings in many packages. More on the Laravel tools under apps.

More articles

All articles