Admin LTE for Admin Panel in LARAVEL with admin login features
Table of Contents
Introduction
This tutorial will guide you through setting up an Admin LTE template for an admin panel in a Laravel application, complete with admin login features. Admin LTE is a popular open-source admin dashboard template that provides a responsive layout, making it a great choice for building administrative interfaces. By the end of this guide, you will have a functional admin panel integrated with Laravel.
Step 1: Setting Up Laravel
-
Install Laravel:
- Ensure you have Composer installed on your machine.
- Run the following command to create a new Laravel project:
composer create-project --prefer-dist laravel/laravel admin-panel
-
Navigate to the Project Directory:
cd admin-panel -
Start the Development Server:
php artisan serve- Your application will be accessible at
http://localhost:8000.
- Your application will be accessible at
Step 2: Install Admin LTE
-
Download Admin LTE:
- Clone the Admin LTE repository from GitHub or download it from the official website.
- You can use the command:
git clone https://github.com/Colorlib/AdminLTE.git
-
Move Admin LTE Files:
- Copy the
distfolder from the downloaded Admin LTE into your Laravelpublicdirectory, renaming it toadminlte.
- Copy the
-
Link CSS and JS:
- Open your
resources/views/welcome.blade.phpfile and link the Admin LTE CSS and JS files:<link rel="stylesheet" href="{{ asset('adminlte/css/adminlte.min.css') }}"> <script src="{{ asset('adminlte/js/adminlte.min.js') }}"></script>
- Open your
Step 3: Create Authentication
-
Install Laravel Breeze for Authentication:
- Run the following command to install Laravel Breeze:
composer require laravel/breeze --dev - Then, run the installation command:
php artisan breeze:install
- Run the following command to install Laravel Breeze:
-
Run Migrations:
- Execute the migration command to set up the necessary tables:
php artisan migrate
- Execute the migration command to set up the necessary tables:
-
Set Up Routes:
- In your
routes/web.php, ensure you have the following routes for authentication:Route::get('/dashboard', [DashboardController::class, 'index'])->middleware('auth');
- In your
Step 4: Create Admin Dashboard
-
Create Dashboard Controller:
- Generate a new controller:
php artisan make:controller DashboardController
- Generate a new controller:
-
Implement the Index Method:
- Open
DashboardController.phpand add the following code:public function index() { return view('dashboard'); }
- Open
-
Create Dashboard View:
- Create a new Blade view file
resources/views/dashboard.blade.phpand use Admin LTE components:@extends('layouts.app') @section('content') <div class="container"> <h1>Admin Dashboard</h1> <!-- Your Admin LTE code here --> </div> @endsection
- Create a new Blade view file
Step 5: Test Your Application
- Run Your Application:
- Ensure your server is running and navigate to
http://localhost:8000/registerto create a new user. - After registration, log in and check your admin dashboard at
http://localhost:8000/dashboard.
- Ensure your server is running and navigate to
Conclusion
You have successfully set up an Admin LTE admin panel in Laravel with authentication features. You can now customize your dashboard further by adding widgets, charts, and additional functionality as needed. Explore the Admin LTE documentation for more components and layout options to enhance your admin panel.