Loading
Please wait...

Laravel E-Learning Rebuild

1

Part 1: Introduction & Why I'm Upgrading

2

Part 2: Setting Up Laravel 11 + Filament

3

Part 3: Database Schema Design

4

Part 4: Authentication & User Roles

5

Part 5: Building the Exam System

6

Part 6: Real-Time Features

7

Part 7: Testing Strategy

8

Part 8: Deployment

4 Januari 2026

Laravel E-Learning Part 2: Setting Up Laravel 11 with Filament Admin Panel

Step-by-step guide to setting up a fresh Laravel 11 project with Filament 3 for building a modern e-learning admin panel.

3 min read


Prerequisites

Before we start, make sure you have:

  • PHP 8.2 or higher
  • Composer 2.x
  • Node.js 18+ and npm
  • MySQL 8 or PostgreSQL 15+
  • A code editor (VS Code recommended)

Step 1: Create Fresh Laravel 11 Project

composer create-project laravel/laravel elearning-app
cd elearning-app

Laravel 11 comes with a minimal structure. Let's verify the installation:

php artisan --version
# Laravel Framework 11.x.x

Step 2: Configure Database

Update your .env file:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=elearning_db
DB_USERNAME=root
DB_PASSWORD=your_password

Create the database:

mysql -u root -p -e "CREATE DATABASE elearning_db;"

Step 3: Install Filament 3

Filament is the star of our admin panel. Install it:

composer require filament/filament:"^3.2"

Run the Filament installation:

php artisan filament:install --panels

When prompted, accept the defaults. This creates:

  • app/Providers/Filament/AdminPanelProvider.php
  • The admin panel at /admin

Step 4: Create Admin User

php artisan make:filament-user

Enter your details:

Name: Admin Email: [email protected] Password: password

Step 5: Configure Filament Panel

Open app/Providers/Filament/AdminPanelProvider.php:

<?php

namespace App\Providers\Filament;

use Filament\Http\Middleware\Authenticate;
use Filament\Http\Middleware\DisableBladeIconComponents;
use Filament\Http\Middleware\DispatchServingFilamentEvent;
use Filament\Pages;
use Filament\Panel;
use Filament\PanelProvider;
use Filament\Support\Colors\Color;
use Filament\Widgets;
use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
use Illuminate\Cookie\Middleware\EncryptCookies;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken;
use Illuminate\Routing\Middleware\SubstituteBindings;
use Illuminate\Session\Middleware\AuthenticateSession;
use Illuminate\Session\Middleware\StartSession;
use Illuminate\View\Middleware\ShareErrorsFromSession;

class AdminPanelProvider extends PanelProvider
{
    public function panel(Panel $panel): Panel
    {
        return $panel
            ->default()
            ->id('admin')
            ->path('admin')
            ->login()
            ->colors([
                'primary' => Color::Blue,
                'danger' => Color::Rose,
                'success' => Color::Emerald,
            ])
            ->brandName('E-Learning Admin')
            ->favicon(asset('favicon.ico'))
            ->discoverResources(in: app_path('Filament/Resources'), for: 'App\\Filament\\Resources')
            ->discoverPages(in: app_path('Filament/Pages'), for: 'App\\Filament\\Pages')
            ->pages([
                Pages\Dashboard::class,
            ])
            ->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\\Filament\\Widgets')
            ->widgets([
                Widgets\AccountWidget::class,
            ])
            ->middleware([
                EncryptCookies::class,
                AddQueuedCookiesToResponse::class,
                StartSession::class,
                AuthenticateSession::class,
                ShareErrorsFromSession::class,
                VerifyCsrfToken::class,
                SubstituteBindings::class,
                DisableBladeIconComponents::class,
                DispatchServingFilamentEvent::class,
            ])
            ->authMiddleware([
                Authenticate::class,
            ]);
    }
}

Step 6: Install Additional Packages

For our e-learning app, we need some extra packages:

# Spatie permissions for role management
composer require spatie/laravel-permission

# Publish the config
php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider"

# Run migrations
php artisan migrate

Step 7: Set Up Frontend Assets

Install and build:

npm install
npm run build

Step 8: Test Your Setup

Start the development server:

php artisan serve

Visit http://localhost:8000/admin and log in with your admin credentials.

You should see a beautiful Filament dashboard!

Project Structure So Far

PathDescription
app/Filament/Resources/CRUD resources will go here
app/Filament/Pages/Custom pages
app/Filament/Widgets/Dashboard widgets
app/Models/User.phpUser model
app/Providers/Filament/AdminPanelProvider.phpAdmin panel configuration
database/migrations/Database migrations
.envEnvironment configuration

Summary

In this part, we:

  • ✅ Created a fresh Laravel 11 project
  • ✅ Installed and configured Filament 3
  • ✅ Set up database connection
  • ✅ Created an admin user
  • ✅ Customized the admin panel branding
  • ✅ Installed Spatie Permission for roles

What's Next

In Part 3, we'll design the database schema for our e-learning platform, including:

  • Users (Admin, Teacher, Student)
  • Subjects and Courses
  • Exams and Questions
  • Student Results

Continue to Part 3: Database Schema Design →

Continue Reading

Previous article

← Previous Article

Building an Event Management System for a Developer Community

Next Article →

Laravel E-Learning Part 3: Database Schema Design

Next article