blessing-skin-server/app/Listeners/SendEmailVerification.php

25 lines
567 B
PHP
Raw Normal View History

<?php
namespace App\Listeners;
use App\Mail\EmailVerification;
use App\Models\User;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\URL;
class SendEmailVerification
{
public function handle(User $user)
{
if (option('require_verification')) {
$url = URL::signedRoute('auth.verify', ['user' => $user->uid], null, false);
try {
Mail::to($user->email)->send(new EmailVerification(url($url)));
} catch (\Exception $e) {
report($e);
}
}
}
}