Sunday, 18 May 2025

Laravel User Login App – Step-by-Step Guide

 

1. Create a New Laravel Project

First, navigate to your wamp64/www folder (or your preferred location), then run:

composer create-project laravel/laravel login

This will create a new Laravel project named login.


2. Set Up the Database

  1. Create a new database in phpMyAdmin (e.g., login_db).

  2. Open the .env file in your Laravel project and configure your database settings:

DB_DATABASE=login_db
DB_USERNAME=root
DB_PASSWORD=

3. Fix Default String Length (for older MySQL versions)

In App\Providers\AppServiceProvider.php, update the boot method to fix key length issues:

use Illuminate\Support\Facades\Schema;


public function boot()

{

    Schema::defaultStringLength(191);

}

4. Install and Setup Laravel Breeze (Built-in in Laravel 10+)

Laravel Breeze is now easy to set up:

composer require laravel/breeze --dev

php artisan breeze:install

npm install && npm run dev

php artisan migrate

✅ This sets up:

  • A landing page (/)

  • A login page (/login)

  • A registration page (/register)

  • A dashboard page (/dashboard)


5. Run the Application

Start the development server:

php artisan serve

Then open http://127.0.0.1:8000 in your browser.

🧾 Features You Now Have

  • ✅ Welcome landing page

  • ✅ Login functionality

  • ✅ User registration

  • ✅ Protected dashboard (only accessible after login)

You’re now ready to expand the app by adding roles, user management, and more features.

No comments:

Post a Comment

What is Laravel and Why It’s a Great Path for Web Developers

  If you're thinking about diving into web development, you've likely come across the name Laravel . But what is Laravel exactly, an...