Today, We want to share with you Laravel Email Verification Script Example.In this post we will show you laravel 5.7 registration confirmation email, hear for Laravel 5.7 email verification with activation code example we will give you demo and example for implement.In this post, we will learn about laravel 5.4 email verification with activation code with an example.
Laravel Email Verification Script Example
There are the Following The simple About Laravel Email Verification Script Example Full Information With Example and source code.
As I will cover this Post with live Working example to develop Laravel 5 email verification with activation code example
, so the laravel laravel-user-verification for this example is following below.
Step 1: Setup Laravel 5 Create New Project
laravel Web Application new project
composer create-project --prefer-dist laravel/laravel atmiya25
Step 2: Create Laravel Authentication Module
male Laravel Latest version authentication module
php artisan make:auth
simple run default Database migration using Laravel
php artisan migrate
Step 3: Install Libs jrean/laravel-member-verification Package
Setup or Install jrean/laravel-member-verification Laravel package
composer require jrean/laravel-member-verification
config/app.php
//Include Laravel Plugin for providers 'providers' => [ .... Jrean\MemberVerfication\MemberVerficationServiceProvider::class, ], //Include Laravel Plugin for aliases 'aliases' => [ .... 'MemberVerfication' => Jrean\MemberVerfication\Facades\MemberVerfication::class, ] ......
Laravel publish configure some settings file
php artisan vendor:publish --provider="Jrean\MemberVerfication\MemberVerficationServiceProvider" --tag="config"
jrean/laravel-member-verification package
php artisan migrate --path="/vendor/jrean/laravel-member-verification/src/resources/migrations"
Step 4: Create Laravel Middleware
make a Laravel custom middleware for some checking login member
php artisan make:middleware CheckisAuthMember
app/Http/Middleware/CheckisAuthMember.php
member()->verified){ Session::flush(); return redirect('login')->withAlert('Please Your email by verify Correct your correct email before Sign In.'); } return $next($request); } }
app/Http/Kernel.php
\App\Http\Middleware\CheckisAuthMember::class, ]; }
Step 5: Changes SignupController
app/Http/Controller/Auth/SignupController.php
middleware('guest',['except' => ['getmemberVerification', 'getmemberVerificationError']]); } protected function validator(array $data) { return Validator::make($data, [ 'name' => 'required|string|max:255', 'email' => 'required|string|email|max:255|unique:members', 'password' => 'required|string|min:6|confirmed', ]); } protected function create(array $data) { return Member::create([ 'name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password']), ]); } public function sigup(Request $request) { $this->validator($request->all())->validate(); $member = $this->create($request->all()); MemberVerfication::generate($member); MemberVerfication::send($member, 'YOUR LIVE SUBJECT FOR EMAIL VERIFICATION WITH ACTIVATION CODE'); return back()->withAlert('Sign Up successfully, please check Your Email and then verify your email Address.'); } }
Step 6: Use Laravel Middleware and Alert
“checkisAuthMember” middleware
public function __construct() { $this->middleware(['auth','checkisAuthMember']); }
resources/views/auth/sigup.blade.php
Laravel 5 email verification with activation code example
@if(Session::has('alert')){{ Session::get('alert') }} @php Session::forget('alert'); @endphp@endif
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 Laravel Email Verification Script Example.
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.