コード例 #1
0
 /**
  * Send the email verification link via e-mail.
  *
  * @param  \LaravelVerifyEmails\Contracts\Auth\CanVerifyEmail  $user
  * @param  string  $token
  * @param  \Closure|null  $callback
  * @return int
  */
 public function emailVerificationLink(CanVerifyEmailContract $user, $token, Closure $callback = null)
 {
     // We will use the view that was given to the broker to display the
     // verification e-mail. We'll pass a "token" variable into the views
     // so that it may be displayed for an user to click to verify.
     $view = $this->emailView;
     return $this->mailer->send($view, compact('token', 'user'), function ($m) use($user, $token, $callback) {
         $m->to($user->getEmailToVerify());
         if (!is_null($callback)) {
             call_user_func($callback, $m, $user, $token);
         }
     });
 }
コード例 #2
0
 /**
  * Determine if a token record exists and is valid.
  *
  * @param  \LaravelVerifyEmails\Contracts\Auth\CanVerifyEmail  $user
  * @param  string  $token
  * @return bool
  */
 public function exists(CanVerifyEmailContract $user, $token)
 {
     $email = $user->getEmailToVerify();
     $token = (array) $this->getTable()->where('email', $email)->where('token', $token)->first();
     return $token && !$this->tokenExpired($token);
 }