Today, Laravel is a most popular PHP framework and laravel provides us many many very helpful functionality in-built. it's making our web development very easy.
We will share with you in this article how to make user email verification and account activation functionality in laravel 8 applications. Many web application needs to verify user email before they start to use application. Laravel provides convenient methods for sending and verifying email verification requests.
Here we will show you how to use email verification in laravel application
First, we need to create one fresh laravel project using the following composer command. if you want to implement or use email verification functionality in the existing laravel 8 application then this does not need to do for you.
composer create-project --prefer-dist laravel/laravel blog
After, create laravel project in your local system then you should be run migration by the following artisan command.
php artisan migrate
your users
table must contain an email_verified_at
column to store the date and time that the email address was verified. By default, the users
table migration included with the Laravel framework already includes this column. So, all you need to do is run your database migrations:
Laravel used Auth/VerificationController
middleware class for check user email verifed or not. and you should be add the following route in your routes/web.php
file.
Auth::routes(['verify' => true]);
Route middleware can be used to only allow verified users to access a given route. Laravel ships with a verified middleware, which is defined at Illuminate\Auth\Middleware\EnsureEmailIsVerified
. Since this middleware is already registered in your application's HTTP kernel, all you need to do is attach the middleware to a route definition:
Route::get('edit-profile', function () {
// Only verified users may enter...
})->middleware('verified');
Into the last we need to generate mail templates view, laravel provide ready made mail view. you can generate it help of the run the following command in your terminal.
composer require laravel/ui --dev
php artisan ui vue --auth
After, run the above all required mails templates automatically generated in this path resources/views/auth/
As you can see, user email verification functionality is very easy to use in laravel application help of Auth::routes
.
We hope these tutorials help everyone.
Hi, My name is Harsukh Makwana. i have been work with many programming language like php, python, javascript, node, react, anguler, etc.. since last 5 year. if you have any issue or want me hire then contact me on [email protected]
How to Set CSS background-image Property Using jQuery
Use the jQuery CSS() Method To set th...Start Applications Automatically on Login in Ubuntu
Many of us need to open certain applicat...How to Abort Ajax Requests using jQuery
Sometimes you might want to cancel the a...How to Capture Browser Window Resize Event in JavaScript
Use the addEventListener() Met...Django 3 CRUD Tutorial Example with MySQL and Bootstrap
Django 3 is released with full async sup...