Skip to content

Commit c798f80

Browse files
committed
Merge branch 'develop'
2 parents 85d5133 + fe538d0 commit c798f80

File tree

1 file changed

+43
-28
lines changed

1 file changed

+43
-28
lines changed

src/UserVerification.php

Lines changed: 43 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,15 @@ protected function updateUser($user)
331331
protected function emailVerificationLink(AuthenticatableContract $user, $subject, $from = null, $name = null)
332332
{
333333
return $this->mailer->send($this->emailView, compact('user'), function ($m) use ($user, $subject, $from, $name) {
334-
$m = $this->createVerificationEmail($m, $user, $subject, $from, $name);
334+
if (! empty($from)) {
335+
$m->from($from, $name);
336+
}
337+
338+
$m->to($user->email);
339+
340+
$m->subject(is_null($subject) ? trans('laravel-user-verification::user-verification.verification_email_subject') : $subject);
341+
342+
event(new VerificationEmailSent($user));
335343
});
336344
}
337345

@@ -347,7 +355,15 @@ protected function emailVerificationLink(AuthenticatableContract $user, $subject
347355
protected function emailQueueVerificationLink(AuthenticatableContract $user, $subject, $from = null, $name = null)
348356
{
349357
return $this->mailer->queue($this->emailView, compact('user'), function ($m) use ($user, $subject, $from, $name) {
350-
$m = $this->createVerificationEmail($m, $user, $subject, $from, $name);
358+
if (! empty($from)) {
359+
$m->from($from, $name);
360+
}
361+
362+
$m->to($user->email);
363+
364+
$m->subject(is_null($subject) ? trans('laravel-user-verification::user-verification.verification_email_subject') : $subject);
365+
366+
event(new VerificationEmailSent($user));
351367
});
352368
}
353369

@@ -364,7 +380,15 @@ protected function emailQueueVerificationLink(AuthenticatableContract $user, $su
364380
protected function emailQueueOnVerificationLink($queue, AuthenticatableContract $user, $subject, $from = null, $name = null)
365381
{
366382
return $this->mailer->queueOn($queue, $this->emailView, compact('user'), function ($m) use ($user, $subject, $from, $name) {
367-
$m = $this->createVerificationEmail($m, $user, $subject, $from, $name);
383+
if (! empty($from)) {
384+
$m->from($from, $name);
385+
}
386+
387+
$m->to($user->email);
388+
389+
$m->subject(is_null($subject) ? trans('laravel-user-verification::user-verification.verification_email_subject') : $subject);
390+
391+
event(new VerificationEmailSent($user));
368392
});
369393
}
370394

@@ -381,7 +405,15 @@ protected function emailQueueOnVerificationLink($queue, AuthenticatableContract
381405
protected function emailLaterVerificationLink($seconds, AuthenticatableContract $user, $subject, $from = null, $name = null)
382406
{
383407
return $this->mailer->later($seconds, $this->emailView, compact('user'), function ($m) use ($user, $subject, $from, $name) {
384-
$m = $this->createVerificationEmail($m, $user, $subject, $from, $name);
408+
if (! empty($from)) {
409+
$m->from($from, $name);
410+
}
411+
412+
$m->to($user->email);
413+
414+
$m->subject(is_null($subject) ? trans('laravel-user-verification::user-verification.verification_email_subject') : $subject);
415+
416+
event(new VerificationEmailSent($user));
385417
});
386418
}
387419

@@ -398,33 +430,16 @@ protected function emailLaterVerificationLink($seconds, AuthenticatableContract
398430
protected function emailLaterOnVerificationLink($queue, $seconds, AuthenticatableContract $user, $subject, $from = null, $name = null)
399431
{
400432
return $this->mailer->laterOn($queue, $seconds, $this->emailView, compact('user'), function ($m) use ($user, $subject, $from, $name) {
401-
$m = $this->createVerificationEmail($m, $user, $subject, $from, $name);
402-
});
403-
}
433+
if (! empty($from)) {
434+
$m->from($from, $name);
435+
}
404436

405-
/**
406-
* Creates and format the e-mail to be sent.
407-
*
408-
* @param string $mail
409-
* @param \Illuminate\Contracts\Auth\Authenticatable $user
410-
* @param string $subject
411-
* @param string $from
412-
* @param string $name
413-
* @return mixed
414-
*/
415-
protected function createVerificationEmail($mail, $user, $subject, $from, $name)
416-
{
417-
if (! empty($from)) {
418-
$mail->from($from, $name);
419-
}
437+
$m->to($user->email);
420438

421-
$mail->to($user->email);
439+
$m->subject(is_null($subject) ? trans('laravel-user-verification::user-verification.verification_email_subject') : $subject);
422440

423-
$mail->subject(is_null($subject) ? trans('laravel-user-verification::user-verification.verification_email_subject') : $subject);
424-
425-
event(new VerificationEmailSent($user));
426-
427-
return $mail;
441+
event(new VerificationEmailSent($user));
442+
});
428443
}
429444

430445
/**

0 commit comments

Comments
 (0)