Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel email verification laravel 8 tutorial

<?php
  
namespace AppHttpMiddleware;
  
use Closure;
use IlluminateHttpRequest;
use IlluminateSupportFacadesAuth;
  
class IsVerifyEmail
{
    /**
     * Handle an incoming request.
     *
     * @param  IlluminateHttpRequest  $request
     * @param  Closure  $next
     * @return mixed
     */
    public function handle(Request $request, Closure $next)
    {
        if (!Auth::user()->is_email_verified) {
            auth()->logout();
            return redirect()->route('login')
                    ->with('message', 'You need to confirm your account. We have sent you an activation code, please check your email.');
          }
   
        return $next($request);
    }
}
Source by www.itsolutionstuff.com #
 
PREVIOUS NEXT
Tagged: #laravel #email #verification #laravel #tutorial
ADD COMMENT
Topic
Name
2+5 =