Skip to content
logo1

Appfinz Tech Blogs

Javascript, Laravel, Jquery, Vue Js, Node Js Blogs

Primary Menu logo1

Appfinz Tech Blogs

  • PHP
  • Laravel
  • React
  • React Native
  • Payment Gateway
  • Javascript
  • Jquery
  • Shopify
  • WordPress
  • Angular JS
  • Vue JS
  • Website Trends
  • SEO
  • Node JS
  • Home
  • PHP
  • How to make Email Verifications in Laravel
  • PHP

How to make Email Verifications in Laravel

1 year ago
How to Verify Email Using Laravel, Email Verification Method in Laravel

Hello Artisans, In this blog we will see how to implement Email Verifications in Laravel, How Email Verification works with Laravel Application, We will use laravel Breeze package to implement Email Verifications in Laravel Application, To implement email verification in Laravel, follow these steps:

Step 1: Set Up Your Laravel Project

If you don’t have a Laravel project yet, create one:

composer create-project --prefer-dist laravel/laravel laravel-email-verification

Step 2: Set Up Authentication

Install Laravel Breeze or Laravel Jetstream for authentication scaffolding. Here, we’ll use Laravel Breeze:

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

Step 3: Configure Email Settings

Set up your email configuration in the .env file. Add your SMTP server details:

MAIL_MAILER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=your_username
MAIL_PASSWORD=your_password
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=noreply@example.com
MAIL_FROM_NAME="${APP_NAME}"

Step 4: Enable Email Verification

In your User model (app/Models/User.php), make sure the MustVerifyEmail interface is implemented:

use Illuminate\Contracts\Auth\MustVerifyEmail;

class User extends Authenticatable implements MustVerifyEmail
{
    // other model methods and properties
}

Step 5: Update Auth Routes

In routes/web.php, add the following route to handle email verification:

use Illuminate\Foundation\Auth\EmailVerificationRequest;
use Illuminate\Http\Request;

Route::get('/email/verify', function () {
    return view('auth.verify-email');
})->middleware('auth')->name('verification.notice');

Route::get('/email/verify/{id}/{hash}', function (EmailVerificationRequest $request) {
    $request->fulfill();

    return redirect('/home');
})->middleware(['auth', 'signed'])->name('verification.verify');

Route::post('/email/verification-notification', function (Request $request) {
    $request->user()->sendEmailVerificationNotification();

    return back()->with('message', 'Verification link sent!');
})->middleware(['auth', 'throttle:6,1'])->name('verification.send');

Step 6: Create Email Verification View

Create a new view file for the email verification notice at resources/views/auth/verify-email.blade.php:

@extends('layouts.app')

@section('content')
<div>
    @if (session('message'))
        <div>
            {{ session('message') }}
        </div>
    @endif

    <div>
        Before proceeding, please check your email for a verification link.
        If you did not receive the email, click the button below to request another.
    </div>

    <form method="POST" action="{{ route('verification.send') }}">
        @csrf
        <button type="submit">Resend Verification Email</button>
    </form>
</div>
@endsection

Step 7: Modify Registration Controller

Make sure your registration controller sends a verification email after a user registers. In the RegisteredUserController (or wherever your registration logic is):

use Illuminate\Auth\Events\Registered;

public function store(Request $request)
{
    // validate and create user
    $user = User::create([
        'name' => $request->name,
        'email' => $request->email,
        'password' => Hash::make($request->password),
    ]);

    event(new Registered($user));

    Auth::login($user);

    return redirect()->route('verification.notice');
}

Step 8: Protect Routes

Ensure that your application routes are protected and only accessible to verified users. Use the verified middleware in routes/web.php:

Route::get('/home', [HomeController::class, 'index'])->middleware(['auth', 'verified'])->name('home');

Step 9: Test Email Verification

  1. Register a new user through your registration form.
  2. Check the registered user’s email for the verification link.
  3. Click the verification link to verify the email.
  4. Ensure the user is redirected to the intended page after verification.

I hope this blog will help you to build Make Email Verifications in Laravel

Also Read:

User Login with API Using Laravel 11

solve 500 internal server error in laravel

Paypal Payment Gateway Integration in Laravel 11

Laravel 9 Contact Form Example Tutorial

Laravel Middleware for Auth Admin Users Roles

If you’re planning to revamp your online presence, don’t miss exploring our website designing services and custom website development solutions tailored to your business needs.

About Post Author

9e9449b06621124a84dc2b65c64536676c3fbc88d5e6f9ad9d60cbd72b9a1e20?s=150&d=identicon&r=g

Kishan Kumar || Founder @ Appfinz

administrator

𝗦𝗵𝗼𝗽𝗶𝗳𝘆 𝗣𝗹𝘂𝘀 𝗘𝘅𝗽𝗲𝗿𝘁 | Digital Marketing Consultant (Organic & Paid Outreach) | Built 𝗔𝗽𝗽𝗳𝗶𝗻𝘇 𝗧𝗲𝗰𝗵𝗻𝗼𝗹𝗼𝗴𝗶𝗲𝘀 | Working with Graphics, Website & Performance Marketing Enthusiasts.
Ask for 𝐖𝐞𝐛𝐬𝐢𝐭𝐞 𝐃𝐞𝐯𝐞𝐥𝐨𝐩𝐦𝐞𝐧𝐭 | 𝐒𝐨𝐜𝐢𝐚𝐥 𝐌𝐞𝐝𝐢𝐚 𝐎𝐮𝐭𝐫𝐞𝐚𝐜𝐡 | 𝐆𝐨𝐨𝐠𝐥𝐞 𝐂𝐚𝐦𝐩𝐚𝐢𝐠𝐧𝐬 | 𝐋𝐚𝐫𝐚𝐯𝐞𝐥 & 𝐒𝐡𝐨𝐩𝐢𝐟𝐲 𝐃𝐞𝐯𝐞𝐥𝐨𝐩𝐦𝐞𝐧𝐭

See author's posts

Post Views: 7
Tags: Email Verification Method in Laravel, Email Verifications in Laravel, How to integrate email verification method in laravel, Laravel Email Verification

Continue Reading

Previous User Login with API Using Laravel 11
Next Building a Simple AJAX CRUD Application in Laravel: Add, Edit, Delete, and List

Please Support us

If our blogs help you to solve your problem, you can help us running this blogs by paying for a small coffee brew.

Google Pay/Phonepe/Paytm Number: +91 8340725097

If my blogs help you to find your answer and query, then help us with above mentioned links

React JS

  • React
  • React Native

Difference Between Ionic React Vs React Native

5 years ago
  • React
  • React Native

What is the difference between React Native and React?

6 years ago

Laravel

  • Laravel
  • PHP

Building a Simple AJAX CRUD Application in Laravel: Add, Edit, Delete, and List

1 year ago
  • Laravel

Laravel Custom Authentication | Registration, Login, Logout Process | Laravel login with session

1 year ago
  • Laravel

How to change Password in Laravel Using Tinker Method

1 year ago
  • PHP
  • Laravel

User Login with API Using Laravel 11

1 year ago
  • Laravel

What’s the differences between PUT and PATCH? in laravel

1 year ago

Recent Blogs

  • Social Media

The upsurge of niche social media platforms and what that means for your brand

5 years ago
  • SEO

How Well-Structured Content Supports AI Referenceability    

5 days ago
  • SEO

Best Scientific Equipment Manufacturers in India

2 weeks ago
  • PHP

Why Every Entrepreneur Needs a Digital Business Card in 2025

2 weeks ago
  • Shopify

Shopify Company Guide 2025: Success for Business Owners

1 month ago
  • Shopify

Shopify Ecommerce Website Design Guide for 2025

1 month ago

Appfinz Technologies

Appfinz Technologies has been in the industry for more than 12 years, holding a core motive to make a change in the world by providing solutions perfectly crafted with intelligence and creativity. the company is gradually yet constantly spreading its legs across the world leaving the rat race for the rest and striving to become better than the best!

Our services

  • Shopify Development Company
  • SEO Services In India
  • SEO Packages
  • Digital Marketing Packages
  • Social Media Marketing

Categories

Angular JS Artificial Intelligence Ionic Framework Javascript Jquery Laravel Marketing Node JS Payment Gateway PHP Python React React Native SEO Shopify Social Media VPN Vue JS Website Trends Wordpress
  • Home
  • Instagram
  • Facebook
  • Twitter
  • Linkedin
  • Github
© Appfinz Technologies | All rights reserved.