Today, We want to share with you Email Verification in Laravel 5.7 Example Tutorial.In this post we will show you Email Verification in laravel 5.7 Example, hear for Laravel 5.7 Email Verification Tutorial Step By Step we will give you demo and example for implement.In this post, we will learn about How to Enable Laravel 5.7 Email Verification Support with an example.
Email Verification in Laravel 5.7 Example Tutorial
There are the Following The simple About Email Verification in Laravel 5.7 Example Tutorial Full Information With Example and source code.
As I will cover this Post with live Working example to develop send confirmation email after registration in Laravel 5.7, so the some major files and Directory structures for this example is following below.
- Setup Laravel 5.7 Application
- Settings SQL Database
- Make Laravel 5.7 Auth Scaffolding
- Include a mustVerify
- Include User model
- Include Email Route
- Send Email Laravel 5.7 Configure
- Run Project email verification functionality
Step #1: Setup Laravel 5.7 Application
composer create-project --prefer-dist laravel/laravel pakainfo
Step #2: Settings SQL Database
Laravel 5.7 .env file config
DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=pakainfo DB_USERNAME=root DB_PASSWORD=
migrate table in Laravel 5.7
php artisan migrate
Step #3: Make Laravel 5.7 Auth Scaffolding
php artisan make:auth
resources/views/auth/verify.blade.php
@extends('layouts.app') @section('content') <h3>Laravel 5.7 Email Verification Example Tutorial</h3> <b>Email Verification in Laravel 5.7 Example Tutorial</b> <div class="container"> <div class="row pakinfo justify-content-center"> <div class="pakinfo col-md-8"> <div class="laravel crud"> <div class="pakinfo card-header">{{ __('Verify Your Email Address') }}</div> <div class="card-body"> @if (session('resent')) <div class="alert alert-success" role="alert"> {{ __('A fresh verification link has been sent to your email address.') }} </div> @endif {{ __('Before pe Any typroceeding, please check your Inbox email for a verification link.') }} {{ __('If you did not get the email') }}, <a href="{{ route('verification.resend') }}">{{ __('click here to request some another') }}</a>. </div> </div> </div> </div> </div> @endsection
Step #4: Include a mustVerify Laravel in the User model
User.php
//User.php <?php namespace App; use Illuminate\Notifications\Notifiable; use Illuminate\Contracts\Auth\MustVerifyEmail; use Illuminate\Foundation\Auth\User as Authenticatable; //Laravel 5.7 Model class User extends Authenticatable implements MustVerifyEmail { use Notifiable; protected $fillable = [ 'name', 'email', 'password', ]; protected $hidden = [ 'password', 'remember_token', ]; }
Step 5: Include Email Route
routes/web.php
Auth::routes(['verify' => true]);
WelcomeController.php
//WelcomeController.php public function __construct() { $this->middleware(['auth','verified']); }
Step #6: Settings Email
Laravel 5.7.env files
We are using simple free mailtrap send mail for this simple Laravel 5.7 example. Therefor log in to the https://mailtrap.io/signin. and get username as well as password Key.
//.env MAIL_DRIVER=smtp MAIL_HOST=smtp.mailtrap.io MAIL_PORT=2525 MAIL_USERNAME=YOUR_mailtrap_username MAIL_PASSWORD=Your_mailtrap_password MAIL_ENCRYPTION=tls
Step 7: Laravel 5.7 Email Send & Verification
Test the Laravel email Send and verification Link or Button
we are used to mailtrap, and We can see that Email verification Laravel mail has arrived
Angular 6 CRUD Operations Application Tutorials
Read :
Summary
You can also read about AngularJS, ASP.NET, VueJs, PHP.
I hope you get an idea about Email Verification in Laravel 5.7 Example Tutorial.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, donโt forget to share.