1. Home
  2. Laravel
  3. Basic
  4. 2.🧠 Laravel Jetstream + Livewire Authentication System – āĻŦāĻžāĻ‚āϞāĻž āϟāĻŋāωāĻŸā§‹āϰāĻŋāϝāĻŧāĻžāϞ

2.🧠 Laravel Jetstream + Livewire Authentication System – āĻŦāĻžāĻ‚āϞāĻž āϟāĻŋāωāĻŸā§‹āϰāĻŋāϝāĻŧāĻžāϞ

🔰 āϧāĻžāĻĒ ā§§: Jetstream āχāύāĻ¸ā§āϟāϞ āĻ•āϰāĻž

Jetstream āχāύāĻ¸ā§āϟāϞ āĻ•āϰāĻžāϰ āϜāĻ¨ā§āϝ āύāĻŋāĻšā§‡āϰ āĻ•āĻŽāĻžāĻ¨ā§āĻĄ āϚāĻžāϞāĻžāĻ“:

composer require laravel/jetstream

āϤāĻžāϰāĻĒāϰ Livewire āĻ…āĻĒāĻļāύ āĻĻāĻŋāϝāĻŧ⧇ Jetstream āχāύāĻ¸ā§āϟāϞ āĻ•āϰ⧋:

php artisan jetstream:install livewire

✅ āĻāϟāĻž āύāĻŋāĻšā§‡āϰ āĻĢāĻŋāϚāĻžāϰāϗ⧁āϞ⧋ āĻĻāĻŋāϝāĻŧ⧇ Blade āĻ“ Livewire āĻ­āĻŋāĻ¤ā§āϤāĻŋāĻ• āĻĢāĻžāχāϞ āϤ⧈āϰāĻŋ āĻ•āϰāĻŦ⧇:

  • Login
  • Register
  • Password Reset
  • Email Verification
  • Profile Management
  • 2FA (Optional)

âš™ī¸ āϧāĻžāĻĒ ā§¨: Assets āχāύāĻ¸ā§āϟāϞ āĻ“ āĻŦāĻŋāĻ˛ā§āĻĄ āĻ•āϰāĻž (Tailwind CSS + JS)

đŸ“Ļ āĻĢā§āϰāĻ¨ā§āĻŸā§‡āĻ¨ā§āĻĄ āĻĒā§āϝāĻžāϕ⧇āϜ āχāĻ¨ā§āϏāϟāϞ:

npm install

đŸ› ī¸ Assets āĻŦāĻŋāĻ˛ā§āĻĄ:

npm run dev

âžĄī¸ Tailwind CSS āĻāĻŦāĻ‚ JS āĻĢāĻžāχāϞāϗ⧁āϞ⧋ public/build āĻĢā§‹āĻ˛ā§āĻĄāĻžāϰ⧇ āĻ•āĻŽā§āĻĒāĻžāχāϞ āĻšāϝāĻŧ⧇ āϝāĻžāĻŦ⧇āĨ¤

āĻĒā§āϰ⧋āĻĄāĻžāĻ•āĻļāύ āϏāĻžāĻ°ā§āĻ­āĻžāϰ⧇ āϗ⧇āϞ⧇ npm run build āϚāĻžāϞāĻžāϤ⧇ āĻšāĻŦ⧇āĨ¤


đŸ—ƒī¸ āϧāĻžāĻĒ ā§Š: āĻĄā§‡āϟāĻžāĻŦ⧇āϏ āĻŽāĻžāχāĻ—ā§āϰ⧇āĻļāύ āϚāĻžāϞāĻžāύ⧋

php artisan migrate

âžĄī¸ āĻāϤ⧇ āύāĻŋāĻšā§‡āϰ āĻŸā§‡āĻŦāĻŋāϞāϗ⧁āϞ⧋ āϤ⧈āϰāĻŋ āĻšāĻŦ⧇:

  • users
  • password_resets
  • email_verification
  • personal_access_tokens
  • sessions
  • team_* (optional)

🚀 āϧāĻžāĻĒ ā§Ē: Laravel āϏāĻžāĻ°ā§āĻ­āĻžāϰ āϚāĻžāϞāĻžāύ⧋

php artisan serve

âžĄī¸ āĻŦā§āϰāĻžāωāϜāĻžāϰ⧇ āĻ—āĻŋāϝāĻŧ⧇ āĻ­āĻŋāϜāĻŋāϟ āĻ•āϰ⧋:

http://localhost:8000

āϤ⧁āĻŽāĻŋ āĻāĻ–āύ Login, Register, Forgot Password āĻĒ⧇āϜ āĻĻ⧇āĻ–āϤ⧇ āĻĒāĻžāϰāĻŦ⧇āĨ¤


đŸ“Ŧ āϧāĻžāĻĒ ā§Ģ: Email Verification āϚāĻžāϞ⧁/āĻŦāĻ¨ā§āϧ āĻ•āϰāĻž

✅ āϚāĻžāϞ⧁ āϰāĻžāĻ–āϤ⧇ āϚāĻžāχāϞ⧇:

.env āĻĢāĻžāχāϞ⧇ āύāĻŋāĻšā§‡āϰ āϞāĻžāχāύāϟāĻŋ āύāĻŋāĻļā§āϚāĻŋāϤ āĻ•āϰ⧋:

FEATURES=registration,profile-update,passwords,email-verification

āĻāĻŦāĻ‚ User āĻŽāĻĄā§‡āϞ⧇ MustVerifyEmail āχāĻ¨ā§āϟāĻžāϰāĻĢ⧇āϏ āϝ⧁āĻ•ā§āϤ āφāϛ⧇ āĻ•āĻŋāύāĻž āĻšā§‡āĻ• āĻ•āϰ⧋:

use Illuminate\Contracts\Auth\MustVerifyEmail;

class User extends Authenticatable implements MustVerifyEmail

âžĄī¸ āĻāĻ–āύ āχāωāϜāĻžāϰ āϰ⧇āϜāĻŋāĻ¸ā§āĻŸā§āϰ⧇āĻļāύ⧇āϰ āĻĒāϰ “Verify Your Email” āĻĒ⧇āĻœā§‡ āϰāĻŋāĻĄāĻžāχāϰ⧇āĻ•ā§āϟ āĻšāĻŦ⧇ āĻāĻŦāĻ‚ āχāĻŽā§‡āχāϞ⧇ āϭ⧇āϰāĻŋāĻĢāĻŋāϕ⧇āĻļāύ āϞāĻŋāĻ‚āĻ• āĻĒāĻžāĻ āĻžāĻŦ⧇āĨ¤


❌ Email Verification āĻŦāĻ¨ā§āϧ āĻ•āϰāϤ⧇ āϚāĻžāχāϞ⧇:

  • .env āĻĢāĻžāχāϞ⧇ FEATURES āĻĨ⧇āϕ⧇ email-verification āϏāϰāĻŋāϝāĻŧ⧇ āĻĢ⧇āϞ⧋āĨ¤
FEATURES=registration,profile-update,passwords
  • āĻ…āĻĨāĻŦāĻž User āĻŽāĻĄā§‡āϞ āĻĨ⧇āϕ⧇ implements MustVerifyEmail āϏāϰāĻŋāϝāĻŧ⧇ āĻĻāĻžāĻ“āĨ¤

đŸ§Ē āϧāĻžāĻĒ ā§Ŧ: Email Sending Configuration (Mailtrap āĻŦāĻž SMTP āĻĻāĻŋāϝāĻŧ⧇)

.env āĻĢāĻžāχāϞ⧇ Mail āĻ•āύāĻĢāĻŋāĻ—āĻžāϰ āĻ•āϰ⧋:

MAIL_MAILER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=your_mailtrap_username
MAIL_PASSWORD=your_mailtrap_password
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=hello@example.com
MAIL_FROM_NAME="Laravel Ecommerce"

đŸ“Ļ Mailtrap: https://mailtrap.io āĻĨ⧇āϕ⧇ āĻāĻ•āĻžāωāĻ¨ā§āϟ āĻ•āϰ⧇ credentials āύāĻžāĻ“āĨ¤

āĻŸā§‡āĻ¸ā§āϟ āĻ•āϰāϤ⧇ āϚāĻžāχāϞ⧇:

php artisan tinker
>>> use Illuminate\Support\Facades\Mail;
>>> Mail::raw('This is a test', fn($m) => $m->to('you@example.com')->subject('Test Mail'));

🧑‍🎨 āϧāĻžāĻĒ ā§­: Authentication Page Customization (Blade āĻĢāĻžāχāϞ)

āϏāĻŦ āĻĢāĻ°ā§āĻŽ āĻĒ⧇āχāϜ āĻĨāĻžāϕ⧇ āĻāĻ–āĻžāύ⧇:

resources/views/auth/

āϤ⧋āĻŽāĻžāϰ āχāĻšā§āϛ⧇āĻŽāϤ⧋ Login, Register, Forgot Password āĻĒ⧇āχāĻœā§‡ āĻŸā§‡āχāϞāωāχāĻ¨ā§āĻĄ CSS āĻĻāĻŋāϝāĻŧ⧇ āĻĄāĻŋāϜāĻžāχāύ āĻšā§‡āĻžā§āϜ āĻ•āϰāϤ⧇ āĻĒāĻžāϰ⧋āĨ¤

āωāĻĻāĻžāĻšāϰāĻŖ:

<!-- register.blade.php -->
<x-jet-authentication-card>
    <x-slot name="logo">
        <img src="{{ asset('images/logo.png') }}" class="h-12">
    </x-slot>

    <x-jet-validation-errors class="mb-4" />
    
    <form method="POST" action="{{ route('register') }}">
        @csrf
        <div>
            <x-jet-label for="name" value="āύāĻžāĻŽ" />
            <x-jet-input id="name" name="name" required autofocus autocomplete="name" />
        </div>
        ...
    </form>
</x-jet-authentication-card>

🔐 āϧāĻžāĻĒ ā§Ž: Middleware āĻĻāĻŋāϝāĻŧ⧇ āχāĻŽā§‡āχāϞ āϭ⧇āϰāĻŋāĻĢāĻŋāϕ⧇āĻļāύ āĻšā§‡āĻ•

āϝāĻĻāĻŋ āϕ⧋āύ⧋ āĻĒ⧇āχāĻœā§‡ āĻļ⧁āϧ⧁ āχāĻŽā§‡āχāϞ āϭ⧇āϰāĻŋāĻĢāĻžāϝāĻŧ⧇āĻĄ āχāωāϜāĻžāϰ āĻāĻ•ā§āϏ⧇āϏ āĻĒāĻžāϝāĻŧ:

Route::middleware(['auth', 'verified'])->group(function () {
    Route::get('/dashboard', fn() => view('dashboard'))->name('dashboard');
});

📌 āϰāĻŋāĻ•ā§āϝāĻžāĻĒ (āϏāĻ‚āĻ•ā§āώ⧇āĻĒ⧇):

āĻ•āĻžāϜāĻ•āĻŽāĻžāĻ¨ā§āĻĄ/āĻĢāĻžāχāϞ
Jetstream āχāĻ¨ā§āϏāϟāϞphp artisan jetstream:install livewire
Assets āĻŦāĻŋāĻ˛ā§āĻĄnpm install && npm run dev
DB āĻŽāĻžāχāĻ—ā§āϰ⧇āϟphp artisan migrate
Laravel āϏāĻžāĻ°ā§āĻ­āĻžāϰphp artisan serve
Email Verification āϚāĻžāϞ⧁.env + User model
āĻ•āĻžāĻ¸ā§āϟāĻŽ āĻĄāĻŋāϜāĻžāχāύresources/views/auth/
Mail āϏ⧇āϟāφāĻĒ.env mail config

🔔 āĻĒāϰāĻŦāĻ°ā§āϤ⧀ āϧāĻžāĻĒ⧇ āϤ⧁āĻŽāĻŋ āϚāĻžāχāϞ⧇ āϕ⧀ āϕ⧀ āĻ•āϰāϤ⧇ āĻĒāĻžāϰ⧋?

  1. Spatie Permission āĻĻāĻŋāϝāĻŧ⧇ Admin/Customer Role āϤ⧈āϰāĻŋ
  2. Filament Admin Panel āχāĻ¨ā§āϟāĻŋāĻ—ā§āϰ⧇āĻļāύ
  3. Checkout āϏāĻŋāĻ¸ā§āĻŸā§‡āĻŽ āĻāĻŦāĻ‚ Cart āϤ⧈āϰāĻŋ

How can we help?