Basic from select auto in Laravel 8

Basic from select auto in Laravel 8

Laravel 8 Setup Tutorial: Form Select with Login and Dashboard

This guide will help you set up a Laravel 8 project with user login, email configuration for password resets, and a simple dashboard UI.

Step 1: Install Laravel 8

Open your terminal and run the following command to create a new Laravel project:

composer create-project --prefer-dist laravel/form_select

Step 2: Configure .env File

Update your database and mail credentials in the .env file located at the root of your Laravel project.

Database Configuration:

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

 Email Configuration (For Forgot Password Feature):

MAIL_DRIVER=smtp MAIL_HOST=smtp.gmail.com MAIL_PORT=587 MAIL_USERNAME=your_email@gmail.com MAIL_PASSWORD='your_email_password' MAIL_ENCRYPTION=tls

Step 3: Run Migrations

Once the DB is configured, create your tables by running:

php artisan migrate

Step 4: Add Dashboard UI

Create or update the file at resources/views/dashboard/dashboard.blade.php and add the following snippet to display today's absentees:

<div class="col-md-12 col-lg-6 col-xl-4 d-flex"> <div class="card flex-fill"> <div class="card-body"> <h4 class="card-title">Today Absent <span class="badge bg-inverse-danger ml-2">5</span></h4> <div class="leave-info-box"> <div class="media align-items-center"> <a href="profile.html" class="avatar"><img alt="" src="assets/img/user.jpg"></a> <div class="media-body"> <div class="text-sm my-0">Martin Lewis</div> </div> </div> <div class="row align-items-center mt-3"> <div class="col-6"> <h6 class="mb-0">4 Sep 2019</h6> <span class="text-sm text-muted">Leave Date</span> </div> <div class="col-6 text-end"> <span class="badge bg-inverse-danger">Pending</span> </div> </div> </div> <div class="leave-info-box"> <div class="media align-items-center"> <a href="profile.html" class="avatar"><img alt="" src="assets/img/user.jpg"></a> <div class="media-body"> <div class="text-sm my-0">Martin Lewis</div> </div> </div> <div class="row align-items-center mt-3"> <div class="col-6"> <h6 class="mb-0">4 Sep 2019</h6> <span class="text-sm text-muted">Leave Date</span> </div> <div class="col-6 text-end"> <span class="badge bg-inverse-success">Approved</span> </div> </div> </div> <div class="load-more text-center"> <a class="text-dark" href="javascript:void(0);">Load More</a> </div> </div> </div> </div>

Step 7: Create Login Controller

Generate a controller for login logic:

php artisan make:controller LoginController

Then, update it as needed in app/Http/Controllers/Auth/LoginController.php:

<?php namespace App\Http\Controllers\Auth; use App\Http\Controllers\Controller; class LoginController extends Controller { // You can use Laravel's built-in Auth traits or customize login logic here }

Step 9: Add Routes

Open routes/web.php and define your routes:

use Illuminate\Support\Facades\Route; use App\Http\Controllers\HomeController; Route::get('/home', [HomeController::class, 'index'])->name('home'); Route::get('em/dashboard', [HomeController::class, 'emDashboard'])->name('em/dashboard');

Step 10: Run Development Server

Start the Laravel development server:

php artisan serve

Now, open your browser and go to:

http://localhost/form_select/public/

You should see your login page and be able to navigate to the dashboard after logging in.

Final Tips

  • Don't forget to run php artisan make:auth (Laravel UI) or use Jetstream/Breeze for full auth scaffolding.

  • Make sure your uploads, storage, and bootstrap/cache folders are writable (chmod -R 775 if needed).

  • You can use Laravel's Mail functionality to test password reset emails.

Let me know if you'd like me to package this into a downloadable .zip, or if you want to expand with roles, permissions, or charts in the dashboard!

Soeng Souy

Soeng Souy

Website that learns and reads, PHP, Framework Laravel, How to and download Admin template sample source code free.

Post a Comment

CAN FEEDBACK
close