Laravel

How to setup Email Verification with Breeze in Laravel 8

In this tutorials of Laravel, we will show you how to enable Laravel 8 Email Verification via Breeze package.

Steps

  • Install Laravel 8
  • Require Laravel Breeze Package
  • Install Laravel Breeze Package
  • Update User Model
  • Update Web.php
  • Migrate Database

Install Laravel 8

composer create-project laravel/laravel email-verification

Require Laravel Breeze Package

cd email-verification
composer require laravel/breeze --dev

Install Laravel Breeze Package

php artisan breeze:install

Update User Model

Path: app/Models/User.php, update class User extends Authenticatable to class User extends Authenticatable implements MustVerifyEmail. In below User Model we implemented MustVerifyEmail interface on User class.

<?php

namespace App\Models;

use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;

class User extends Authenticatable implements MustVerifyEmail
{
    use HasApiTokens, HasFactory, Notifiable;

    /**
     * The attributes that are mass assignable.
     *
     * @var array<int, string>
     */    protected $fillable = [
        'name',
        'email',
        'password',
    ];

Update Web.php

Here in web.php file, we add ‘verified’ in middleware.

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

Migrate Database

php artisan migrate
CADSLIST SEO BLOG

Recent Posts

The Best Spas in Dubai for the Ultimate Luxury Experience

A list of the best spas in Dubai that will relax your body and mind…

October 3, 2023

12 of The Best Make-Up Brands Available in Canada

Canada is a majestically beautiful country full of natural wonders and is also home to…

September 22, 2023

10 Best Makeup Brands in the United States

Here is a list of the Best USA Makeup Brands in 2023, that are safe…

September 20, 2023

The Best Australian Makeup Brands That You Need To Try

Here is a list of the Best Australian Makeup Brands in 2023, that are safe…

September 10, 2023

How to Create TikTok Content that can go Viral Easily?

Content creators always try hard to make their content reach a large number of followers…

September 8, 2023

Top Job Websites for Truck Drivers in Canada

Truck companies are constantly searching for people to fulfill their logistics, transportation, and supply chain…

August 11, 2023