Kritim Yantra
Feb 28, 2025
AdminLTE is a popular, open-source admin dashboard template built with Bootstrap. It offers a sleek, responsive, and customizable interface that is perfect for building admin panels, backend systems, and dashboards. When paired with Laravel 12, AdminLTE makes it easy to build beautiful, functional interfaces in less time.
In this guide, youβll learn how to integrate AdminLTE with Laravel 12 using the powerful jeroennoten/laravel-adminlte
package β from setup to dashboard creation.
To begin, ensure you have Composer installed on your system. Then, create a new Laravel 12 project by running:
composer create-project --prefer-dist laravel/laravel adminlte-laravel "12.*"
Navigate into your project folder:
cd adminlte-laravel
Now install the official AdminLTE package for Laravel via Composer:
composer require jeroennoten/laravel-adminlte
This package provides seamless integration between Laravel and AdminLTE, including pre-built layout support and configuration options.
After installation, run the AdminLTE install command:
php artisan adminlte:install
This command sets up:
config/adminlte.php
To build a consistent layout for all admin views, create a new Blade layout file.
resources/views/admin/app.blade.php
@extends('adminlte::page')
@section('title', $title ?? 'Dashboard')
@section('content_header')
<h1>@yield('page-title', 'Admin Panel')</h1>
@stop
@section('content')
{{-- Dynamic content --}}
@yield('content')
@stop
@section('css')
<link rel="stylesheet" href="{{ asset('css/admin-custom.css') }}">
@stack('styles')
@stop
@section('js')
@stack('scripts')
@stop
This file acts as a master layout. You can now use it across all admin views by extending it.
Now letβs create a dashboard page that uses the admin layout.
resources/views/admin/dashboard.blade.php
@extends('admin.app')
@section('title', 'Dashboard')
@section('page-title', 'Admin Dashboard')
@section('content')
<div class="card">
<div class="card-body">
<p>Welcome to your admin dashboard!</p>
</div>
</div>
@endsection
Generate a controller to handle the dashboard route:
php artisan make:controller Admin/DashboardController
Then update the controller as follows:
app/Http/Controllers/Admin/DashboardController.php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
class DashboardController extends Controller
{
public function index()
{
return view('admin.dashboard');
}
}
Open the routes/web.php
file and add the following routes:
use App\Http\Controllers\Admin\DashboardController;
Route::prefix('admin')->name('admin.')->group(function () {
Route::get('/dashboard', [DashboardController::class, 'index'])->name('dashboard');
});
This ensures that only authenticated users can access the admin dashboard at /admin/dashboard
.
The sidebar menu is fully configurable via config/adminlte.php
. Open that file and scroll to the menu
array:
'menu' => [
[
'text' => 'Dashboard',
'url' => 'admin/dashboard',
'icon' => 'fas fa-tachometer-alt',
],
// Add more links here
],
This will automatically show the Dashboard link in the sidebar.
To add custom styles, create your CSS file:
public/css/admin-custom.css
body {
background-color: #f5f6fa;
}
.card {
border-radius: 0.5rem;
}
Then reference it in the layout (admin/app.blade.php
):
@section('css')
<link rel="stylesheet" href="{{ asset('css/admin-custom.css') }}">
@stack('styles')
@stop
You can also add per-page styles and scripts using @push
:
@push('styles')
<link rel="stylesheet" href="{{ asset('css/some-feature.css') }}">
@endpush
@push('scripts')
<script src="{{ asset('js/some-feature.js') }}"></script>
@endpush
Start the Laravel development server:
php artisan serve
Now visit:
http://localhost:8000/admin/dashboard
If authentication is enabled, youβll be prompted to log in. After that, youβll see your fully working AdminLTE dashboard.
If your project doesnβt yet have login/register features, you can install Laravel Breeze:
composer require laravel/breeze --dev
php artisan breeze:install blade
npm install && npm run dev
php artisan migrate
Then register and log in to access the admin area.
Step | Description |
---|---|
1οΈβ£ | Create a Laravel 12 project |
2οΈβ£ | Install the jeroennoten/laravel-adminlte package |
3οΈβ£ | Run adminlte:install to set up config and assets |
4οΈβ£ | Create a reusable admin layout in resources/views/admin/app.blade.php |
5οΈβ£ | Build your admin pages using @extends('admin.app') |
6οΈβ£ | Create a dashboard controller and view |
7οΈβ£ | Define admin routes using middleware and prefix |
8οΈβ£ | Configure the sidebar menu in config/adminlte.php |
9οΈβ£ | Add custom CSS/JS files |
π | Test your dashboard via /admin/dashboard |
Integrating AdminLTE into your Laravel 12 application is a smooth and efficient way to build admin panels and dashboards. With its flexible layout system and rich UI components, AdminLTE gives you a ready-made design system to accelerate development and ensure a professional experience for your users.
By following this step-by-step guide, you now have a solid foundation for building out your own admin tools, user management, and analytics dashboard.
Happy coding! π
Robby Balona
Jun 27, 2025 07:36 AM
Please log in to post a comment:
Sign in with Google
Robby Balona
Jun 27, 2025 07:36 AM