/** * Send the email verification link via e-mail. * * @param \Krucas\LaravelUserEmailVerification\Contracts\RequiresEmailVerification $user * @param string $token * @param \Closure|null $callback * @return int */ public function emailVerificationLink(Contracts\RequiresEmailVerification $user, $token, Closure $callback = null) { $view = $this->emailView; return $this->mailer->send($view, compact('token', 'user'), function ($message) use($user, $token, $callback) { $message->to($user->getEmailForVerification()); if (!is_null($callback)) { call_user_func($callback, $message, $user, $token); } }); }
/** * Determine if a token record exists and is valid. * * @param \Krucas\LaravelUserEmailVerification\Contracts\RequiresEmailVerification $user * @param string $token * @return bool */ public function exists(Contracts\RequiresEmailVerification $user, $token) { $email = $user->getEmailForVerification(); $token = (array) $this->getTable()->where('email', $email)->where('token', $token)->first(); return $token && !$this->tokenExpired($token); }