Kritim Yantra
Mar 30, 2025
If you're looking for an easy way to build admin panels in Laravel without writing tons of code, Filament PHP is the perfect solution!
In this step-by-step tutorial, we’ll cover:
✅ What Filament is and why it’s awesome
✅ How to install and set up Filament
✅ Creating a full admin dashboard
✅ Managing data with CRUD operations
✅ Customizing your admin panel
By the end, you’ll have a working admin panel—no advanced coding skills needed!
Filament is a free, open-source admin panel builder for Laravel. It helps you quickly create:
🔹 User dashboards
🔹 Database management systems
🔹 Content management panels
✔ No frontend coding (uses Livewire & Tailwind)
✔ Pre-built forms, tables, and widgets
✔ Super fast to set up
✔ Great for beginners & pros alike
composer create-project laravel/laravel filament-demo
cd filament-demo
composer require filament/filament:"^3.3" -W
php artisan filament:install --panels
This creates:
/admin
route Run:
php artisan make:filament-user
Enter your name, email, and password.
Now, start the server:
php artisan serve
Visit http://localhost:8000/admin and log in!
Let’s create a simple product manager (like a mini e-commerce dashboard).
php artisan make:model Product -m
Edit the migration (database/migrations/..._create_products_table.php
):
Schema::create('products', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->text('description');
$table->decimal('price', 8, 2);
$table->timestamps();
});
Run the migration:
php artisan migrate
This creates CRUD (Create, Read, Update, Delete) operations automatically!
php artisan make:filament-resource Product --generate
Now, visit /admin/products
—you’ll see a ready-to-use product manager!
Edit app/Providers/Filament/AdminPanelProvider.php
:
use Filament\Panel;
public function panel(Panel $panel): Panel
{
return $panel
->brandName('My Shop Admin')
->brandLogo(asset('images/logo.png'));
}
Create a new widget:
php artisan make:filament-widget StatsOverview
Edit app/Filament/Widgets/StatsOverview.php
:
protected function getStats(): array
{
return [
Stat::make('Total Products', Product::count()),
Stat::make('Latest Product', Product::latest()->first()?->name),
];
}
Now, it appears on your dashboard!
Want to restrict access? Update app/Models/User.php
:
use Filament\Models\Contracts\FilamentUser;
class User extends Authenticatable implements FilamentUser
{
public function canAccessPanel(Panel $panel): bool
{
return $this->is_admin; // Only admins can access
}
}
🎉 Congratulations! You’ve built a fully functional admin panel with:
✔ Product management
✔ A custom dashboard
✔ User access control
🔹 Explore Filament’s official docs
🔹 Try adding image uploads or user roles
🔹 Deploy your panel to a live server
Enjoyed this guide? Share it with fellow developers! 🚀
Got questions? Drop them in the comments below! 👇
No comments yet. Be the first to comment!
Please log in to post a comment:
Continue with Google