Laravel Ui Email Verification Complete Tutorial - FreeCodeBlog

Last updated: Jul 01, 2022

Want to make laravel ui vue, react, bootstrap email verification using laravel ui version 3, 2, 1? Laravel ui has a feature for users to verify email. So don't worry you can easily make laravel ui email verification using any kind of laravel ui version like 3, 2, 1. Have you used vue or react js files on laravel ui? Okay laravel Ui Email Verification is the easiest way to process user email verification with vue or react files. So let's start to make laravel ui email verification complete tutorial. You may need to do some configuration like model, route. Don't be late. Let's start to reading.

 

Laravel Ui Email Verification Complete Tutorial
Laravel Ui Email Verification Complete Tutorial

 

1. Laravel Ui.

Want to verify email user email in Laravel using laravel ui authentication package? Have you installed a laravel UI in your laravel project? Not installed yet? Your Laravel project must have a Laravel UI package installed or you may not be able to use the email verification feature in your Laravel project. have you installed laravel ui vue, laravel ui react, laravel ui bootstrap? Don't worry you can make email verification in laravel ui with vue, react, bootstrap. So don't forget to read install laravel ui package in any kind of laravel version tutorial to install laravel ui in your laravel project. Need source code for laravel ui email verification tutorial? You will find the source code for laravel ui email verification tutorial on my GitHub repository.

 

2. Routes Verify True.

Haven't opened the web route file yet? Actually you need to open web route file to change laravel ui authentication routes files. Now open the web route file. You will see an authentication route in your web route file. You need to edit this authentication route for email verification. You may receive errors or may not send email if you cannot edit this authentication route.

 

Auth::routes(['verify' => true]);

 

3. Must Verify Email.

The user model has not yet implemented the authentication must verify email illuminate contracts? Without must verify email user email verification may not working. So it's important to implements must verify in model class. Now need to open user model to implement must verify email. You will notice that Laravel ui has already used the must verify email illuminate contracts in user model. Additionally you need to implement it in the user model class.

 

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

 

4. Notifiable.

Send email to user email or mailtrap dashboard? User model has not yet used Notifiable? Listen friends, email will not be sent to user emails or mailtrap dashboard unless you use illuminate notifications notifiable in the user model. You will notice that Laravel ui has already used the illuminate notifications notifiable in user model. Additionally you need to use into user model class If you do not see it in the user model.

 

use Illuminate\Notifications\Notifiable;
use Notifiable;

 

5. Email.

Did you add email in model class and database migration tables? I don't know. Don't say like that actually you need to confirm that you added email in model fillable class and database migration users tables. The email filed should be unique on users database tables to make email verification. You need to make sure that you added email in user model class fillable or guards. Laravel ui has already added email on user model class and database tables by default. You just have to make sure.

 

$table->string('email')->unique();
protected $fillable = ['email',];

 

6. Mail Configuration.

Have you configured the user model? Now open laravel env file. You will see laravel env file in the project root folder. You need to edit mail configuration in laravel env file to make laravel ui email verification. Please read how to use laravel mailtrap to send email tutorial If you want to send laravel ui user email verification email notification to mailtrap dashboard.

 

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}"

 

7. Verified Middleware.

Don't want to allow users to access web pages without user email verification? You need to 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.

 

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

 

8. Try Email Verification.

Have you configured user model, web route, env file? Yes, then 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.

 

9. Resend Email Verification Email.

Want to resend laravel ui email verification email again? Click on resend button to send laravel ui 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
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

Laravel Breeze User Email Verification Complete Tutorial

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 a... Read More

How To Use Vue Multiselect In Laravel With Vue Js

Sometimes you need to add vue multiselect third party package in your laravel 8 with vue 3 project. We have many third party (vue multiselect) to u... Read More

Generate A Unique Username In Laravel When A User Registers

Unique username in laravel! Yes you can generate a unique username in laravel when user will register her account. So do you want to make a usernam... Read More

Install Laravel Breeze Authentication First Party Package

You can use laravel breeze first party authentication in laravel 8 or other version. In this tutorial I will show you how we can install laravel br... Read More