#1 India's Top IT Training Institute
×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
Mentors

Mentors

Meet the industry experts who train and guide you through your course.

Read More →
Free Resources

Free Resources

Free tutorials, interview questions, tools and calculators to help you learn.

Explore →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →

Setting Up Authentication with php artisan make:auth

Nearly every application with user accounts needs the same core features: registration, login, logout, and password reset. Rather than building this from scratch, Laravel offers official starter kits that scaffold a complete, working authentication system in minutes.

How Laravel Scaffolds Authentication

Older Laravel versions offered a single make:auth command; current versions provide this functionality through official starter kits, installed as a separate package and then set up with an Artisan command. Regardless of the exact command, the result is the same: ready-to-use routes, controllers, and views for handling accounts.

What Gets Scaffolded

FeatureWhat It Provides
RegistrationA form and controller logic for creating new user accounts
Login / LogoutSession-based authentication for returning users
Password ResetEmail-based flow for recovering a forgotten password
Email VerificationOptional flow requiring a confirmed email before full access

Why Use Scaffolding Instead of Building Manually

Scaffolding is the fastest path to authentication, but it's worth understanding what's happening underneath — which is exactly what manual login and registration logic reveals.

From make:auth to Today's Commands

The old php artisan make:auth command was removed from the framework core some time ago, so running it on a modern project simply reports that the command is not defined. Its replacements depend on the project:

SituationWhat to use
New project with the Laravel installerChoose a starter kit (React, Vue or Livewire) when laravel new asks
Existing project using Blade viewsLaravel Breeze, a lightweight kit with Blade templates
Older app that used Bootstrap views from make:authThe laravel/ui package, which keeps the classic scaffolding
Need only the backend, with your own frontendLaravel Fortify, which provides routes and logic without views

Worked Example: Adding Breeze to a Project

Breeze is a good choice for learning, because every controller and view it creates is plain code you can read and change.

composer require laravel/breeze --dev
php artisan breeze:install blade
npm install
npm run dev
php artisan migrate

After the migration creates the users, password_reset_tokens and session tables, visit /register to create an account. Breeze also creates a dashboard route that only signed-in users can open. For the classic Bootstrap-style scaffolding instead, the equivalent commands are:

composer require laravel/ui
php artisan ui bootstrap --auth
npm install && npm run build

Check that the package version supports your Laravel version before installing, since starter kit options change between major releases.

Using Authentication in Your Own Code

Once scaffolding is in place, three tools cover most needs. Route middleware protects pages, the Auth facade gives you the current user, and Blade directives change what the page shows.

// routes/web.php
Route::middleware(['auth', 'verified'])->group(function () {
    Route::get('/dashboard', fn () => view('dashboard'))->name('dashboard');
    Route::get('/orders', [OrderController::class, 'index'])->name('orders');
});

// In a controller
$user = Auth::user();          // or $request->user()
$orders = $user->orders()->latest()->get();

{{-- In a Blade view --}}
@auth
    <p>Welcome back, {{ auth()->user()->name }}</p>
@endauth
@guest
    <a href="{{ route('login') }}">Log in</a>
@endguest

The verified middleware only works when the User model implements MustVerifyEmail, which turns on the email verification flow.

Things to Configure Before Going Live

  • Mail settings: password reset and verification emails fail silently in testing if MAIL_* values in .env are missing. Use a mail-testing tool locally.
  • Login throttling: the starter kits limit repeated failed logins; keep it enabled and tune it rather than removing it.
  • HTTPS and secure cookies: serve the site over HTTPS and set session cookies as secure in production.
  • Redirect paths: update where users land after login if your main page is not the dashboard.
  • Password rules: use the Password validation rule to require sensible length and complexity.

Common slips include forgetting php artisan migrate, forgetting the frontend build step so pages load without styling, and editing vendor files instead of the published controllers and views in your own app folder.

Ready to master Laravel Training Course?

Join Uncodemy's hands-on Laravel program and build real, production-ready applications.

Explore Course