middleware('auth')->except('verify'); $this->middleware('signed')->only('verify'); $this->middleware('throttle:1,1')->only('resend'); $this->middleware('throttle:6,1')->only('verify'); } /** * Mark the authenticated user's email address as verified. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response * @throws \Illuminate\Auth\Access\AuthorizationException */ public function verify(Request $request) { $verifiable = User::find($request->route('id')) ?? Recipient::find($request->route('id')); if (is_null($verifiable)) { throw new AuthorizationException; } if (! hash_equals((string) $request->route('id'), (string) $verifiable->getKey())) { throw new AuthorizationException; } if (! hash_equals((string) $request->route('hash'), sha1($verifiable->getEmailForVerification()))) { throw new AuthorizationException; } if ($verifiable->hasVerifiedEmail()) { return redirect($this->redirectPath()); } if ($verifiable->markEmailAsVerified() && $verifiable instanceof User) { event(new Verified($verifiable)); } if ($request->user() !== null) { $redirect = $verifiable instanceof User ? $this->redirectPath() : route('recipients.index'); } else { $redirect = 'login'; } return redirect($redirect) ->with('verified', true) ->with(['status' => 'Email Address Verified Successfully']); } }