Getting Started with Laravel 12 and Filament Admin Panel: A Beginner's Guide

Author

Kritim Yantra

Mar 30, 2025

Getting Started with Laravel 12 and Filament Admin Panel: A Beginner's Guide

If you're looking to build a web application with an elegant admin interface, Laravel 12 and Filament make an unbeatable combination. Laravel, the popular PHP framework, provides a solid foundation, while Filament offers a sleek, no-code admin panel builder.

In this guide, we'll walk through setting up Laravel 12, installing Filament, and creating a simple blog management system—all with minimal coding.


What Are Laravel and Filament?

Laravel: The PHP Framework for Web Artisans

Laravel is a powerful PHP framework that simplifies web development with features like:

  • Eloquent ORM for database interactions
  • Blade templating for dynamic views
  • Artisan CLI for automating tasks

Filament: The Admin Panel Builder

Filament is an open-source tool built on the TALL stack (Tailwind, Alpine.js, Livewire, Laravel). It provides:

  • Pre-built UI components (forms, tables, notifications)
  • Automatic CRUD generation
  • Seamless Laravel integration

Together, they allow developers to build full-featured admin dashboards quickly.


Setting Up Laravel 12

Prerequisites

  • PHP 8.2+
  • Composer installed
  • Database (MySQL, SQLite, PostgreSQL)

Step 1: Create a New Laravel Project

Run:

laravel new blog-project

Or with Composer:

composer create-project laravel/laravel blog-project

Pro Tip: Choose a starter kit with authentication (like Breeze or Jetstream) to handle user management.


Installing Filament

Navigate into your project:

cd blog-project

Install Filament:

composer require filament/filament:"^3.3" -W

Set up the admin panel:

php artisan filament:install --panels

This creates:

  • app/Providers/Filament/AdminPanelProvider.php
  • Default admin routes (/admin)

Creating an Admin User

Run:

php artisan make:filament-user

Follow the prompts to set an email and password.

Now, visit http://localhost:8000/admin and log in!


Configuring User Access

Update app/Models/User.php to implement FilamentUser:

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

class User extends Authenticatable implements FilamentUser
{
    // ... existing code ...

    public function canAccessPanel(Panel $panel): bool
    {
        return true; // For now, allow all users
    }
}

For production, restrict access:

return $this->email === 'admin@example.com';

Managing Blog Posts with Filament

Step 1: Create a Post Model & Migration

php artisan make:model Post -m

Edit the migration (database/migrations/..._create_posts_table.php):

Schema::create('posts', function (Blueprint $table) {
    $table->id();
    $table->string('title');
    $table->text('content');
    $table->timestamps();
});

Run the migration:

php artisan migrate

Step 2: Generate a Filament Resource

php artisan make:filament-resource Post --generate

This auto-generates:

  • A list view (table of posts)
  • A creation form
  • An edit form

Step 3: Start the Server & Test

php artisan serve

Visit http://localhost:8000/admin/posts to:
Create new posts
Edit existing ones
Delete entries


Why Laravel 12 + Filament Rocks

Zero Breaking Changes in Laravel 12

Laravel 12 (released Feb 2025) ensures smooth upgrades, making it perfect for new projects.

Filament’s Magic

  • No frontend coding needed
  • Real-time updates with Livewire
  • Customizable with Tailwind

Final Thoughts

With Laravel 12 and Filament, you can build a fully functional admin panel in minutes. Whether you're managing blog posts, e-commerce products, or user data, Filament handles the heavy lifting.

Happy coding! 🚀

Tags

Laravel Admin Panel Php

Comments

No comments yet. Be the first to comment!

Please log in to post a comment:

Continue with Google

Related Posts