邮箱验证 是如何工作的?
在查看邮箱验证相关源码的时候,打开 vendor/laravel/framework/src/Illuminate/Auth/Listeners/SendEmailVerificationNotification.php
:
public function handle(Registered $event)
{
if ($event->user instanceof MustVerifyEmail && ! $event->user->hasVerifiedEmail()) {
$event->user->sendEmailVerificationNotification();
}
}
满足$event->user instanceof MustVerifyEmail && ! $event->user->hasVerifiedEmail()
之后,执行 $event->user->sendEmailVerificationNotification()
public function sendEmailVerificationNotification()
{
$this->notify(new Notifications\VerifyEmail);
}
我想请教下,$this->notify(new Notifications\VerifyEmail)
具体是如何工作的?
调用
IlluminateNotificationSender
的 send 方法其中
$response = $this->manager->driver($channel)->send($notifiable, $notification);
创建了MailChannel,再往后看就基本理通了~