Step 1: Create a Laravel 12 Project
Open a terminal and run:
Step 2: Set Up Authentication (Manual)
Create manual authentication:
2.1 Create Auth Routes
Edit routes/web.php
:
2.2 Create AuthController
Create a controller:
Add inside app/Http/Controllers/AuthController.php
:
2.3 Create Login Blade View
Create a directory:
Create file resources/views/auth/login.blade.php
:
Step 3: Create Dashboard and Sidebar Layout Structure
3.1 Create a Folder Structure inside resources/views
3.2 Create Files:
3.3 File Purpose Recap:
-
layouts/app.blade.php
— Main layout wrapping navbar, sidebar, and content. -
partials/sidebar.blade.php
— Dynamic sidebar navigation. -
partials/navbar.blade.php
— Top navbar with user info & logout. -
dashboard.blade.php
— Dashboard content page.
Step 4: Create Menu in DashboardController
Create a controller:
Add menu and view logic in app/Http/Controllers/DashboardController.php
:
Step 5: Define Additional Routes
Add routes for users and reports (for demo, can be placeholders):
resources/views/partials/sidebar.blade.php
)resources/views/partials/navbar.blade.php
)resources/views/layouts/app.blade.php
)resources/views/dashboard.blade.php
)Step 10: Set Up Database and User Model
.env
file located at the root of your Laravel project.Create a users table and migrate:
Example using Tinker:
Inside Tinker, paste the following exact code (no line breaks in the wrong place):
This will create a new user with the hashed password.
To exit Laravel Tinker, just type:
or press Ctrl + D
on your keyboard — no semicolon (;
) needed.
Step 11: Test Your App
-
Start the Laravel dev server:
-
Login with the test user (email: admin@example.com / password: password)
-
You should see the dashboard with the sidebar and navbar, and dynamic menu highlighting.
Summary of Folder Structure: