Laravel Breeze User Email Verification Complete Tutorial - FreeCodeBlog

Last updated: Jul 01, 2022

Did you know that Laravel breeze has a feature called Email Verification? I know little about it. Good, Now you need to know complete information about laravel breeze email verification. So are you ready to know about how we can use user email verification in laravel breeze? Yes. I hope you have little knowledge about laravel and breeze to continue email verification complete tutorial. You need to use the email verification process in the Laravel project after installing laravel breeze user authentication. Let's start to make laravel breeze email verification. You can send laravel breeze email verification notification after reading this tutorial.

 

Laravel Breeze User Email Verification Complete Tutorial
Laravel Breeze User Email Verification Complete Tutorial

 

1. Laravel Breeze.

A Laravel Breeze user authentication package not yet installed on your Laravel project? Want to verify user email in Laravel using laravel breeze authentication package?  Your Laravel project must have a Laravel breeze user authentication package installed. So read install laravel breeze authentication first party package tutorial to install laravel breeze in your laravel project. You cannot use the Email Verification feature in your Laravel project without the Laravel Breeze package.

 

2. Notifiable.

Want to send emails to the environment (user email or mailtrap)? Not yet used Notifiable in the user model? Email will not be sent to the environment (user email or mailtrap) unless you use illuminate notifications notifiable in the user model. Additionally you need to use into user model class If you do not see it in the user model. You will notice that Laravel Breeze has already used the illuminate notifications notifiable in user model.

 

use Illuminate\Notifications\Notifiable;
use Notifiable;

 

3. Must Verify Email.

Now need to open user model to implement must verify email. You will notice that Laravel Breeze has already used the must verify email illuminate contracts in user model. Additionally you need to implement it in the user model class. If you do not use must verify email you may receive errors or email will not be sent.

 

use Illuminate\Contracts\Auth\MustVerifyEmail;
class User extends Authenticatable implements MustVerifyEmail{}

 

4. Mail Configuration.

Have you configured must verify email and notifiable in the user model? Now you need to open laravel env file. You will see laravel env file in the root folder. You need to edit mail configuration in laravel env file to make laravel breeze user email verification. Want to send laravel breeze user email verification email notification to mailtrap? please read how to use laravel mailtrap to send email tutorial for more information.

 

MAIL_MAILER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=null
MAIL_FROM_NAME="${APP_NAME}"

 

5. Verified Middleware.

You can use verified middleware to deny web pages without user email verification. You can use verified middleware in the web route file or the web controller file. Laravel breeze already uses verified middleware on the dashboard route.

 

public function __construct()
{
$this->middleware(['auth', 'verified']);
}

 

6. Send Email.

Now run your Laravel project and try to register a user on the user registration page. I hope an email will send to your environment (user email, mailtrap). If email does not send to your environment (user's email, mailtrap) then follow the steps above.

 

7. Resend Email.

Want to resend laravel breeze email verification email again? Click on resend button to send laravel breeze email verification email notification again.

 

Okay so this is for today. See you again next tutorials. Thanks

Post Tags
Post Writer
masum7323
Masum Biswas (@masum7323)

My name is Masum Biswas. I'm a full stack developer. I live in Bangladesh and I love to write tutorials and tools that can help to other artisan. I am a big fan of PHP, Javascript, JQuery, Laravel, MySQL, VueJS, Tailwind CSS and Bootstrap from the early stage.

Follow Me On
Related Posts
Laravel Mix Complete Tutorial

After installed laravel you will get laravel mix files into project root folder. In this tutorial I will explain you all about laravel mix. so wast... Read More

How To Fix Laravel Session Error On Shared Hosting Cpanel

After uploading the laravel project to cpanel, you can get laravel session error in shared hosting cpanel. You need to fix laravel session error in... Read More

How To Create An Email Account From Cpanel

You can easily create an email account from cpanel to send or receive email from cpanel. Sometimes it becomes necessary to create an email account... Read More

All About Laravel View Controller And Route

Want to make a laravel project? You need to know about laravel view, controller and route to create a laravel project. You can create a laravel pro... Read More

The Best Way To Upload Laravel Projects To Shared Hosting Cpanel

We can easily upload laravel projects to shared hosting (cpanel) using git version control. Git version control (Private Repository) is the best wa... Read More