Ejemplo n.º 1
0
 /**
  * Verify a user's email address.
  *
  * @param $token
  * @return mixed
  */
 public function verify($token)
 {
     $verification = EmailVerification::where('token', $token);
     if ($verification->exists()) {
         $user = $verification->first()->user();
         $user->verified = true;
         $user->save();
         $verification->delete();
         return true;
     }
     return false;
 }
Ejemplo n.º 2
0
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     $verification = EmailVerification::where('user_id', $this->user->id)->first();
     if ($verification) {
         $user = $verification->user();
         $token = $verification->token;
         // Send email
         Mail::queue('user.emails.verification', ["user" => $this->user, "token" => $token], function ($message) {
             $message->to($this->user->email);
             $message->subject('Email verification.');
         });
     }
 }