0

Hi I am trying to make custom email verification after new users registered on my page. I´ve started with adding middleware group inside my web.php

Route::group(['middleware' => ['auth','verified']], function() {
     //my routes
}

Than I created and registered my custom middleware for veryfi users

class WereEmailVerified
{
   
    public function handle(Request $request, Closure $next)
    {
        if(Auth::user()->verified == True)
        {
            return $next($request);
        }

        return response()->json('No ACCESS! Verif your email first');
    }
}

Than I´ve added logic after succefull registration of user it should dispatch event

 public function create_new_user(Array $attributes)
    {
        DB::beginTransaction();

        try {
            $user = User::create($attributes);
            DB::commit();
            event(new Registered($user));

        } catch (\Exception $e) {
            dd($e);
            DB::rollBack();

            throw $e;
        }
    }

But the error has occured:

"Route [verification.verify] not defined."

I tried to look for what I am missing but I don´t really know how to solve this. If you can help me I will be very thankfull...

Young L.
  • 922
  • 3
  • 13
  • 33

0 Answers0