TDoG-Skin/app/Listeners/SendEmailVerification.php
2024-08-17 19:13:54 +08:00

25 lines
567 B
PHP
Executable File

<?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);
}
}
}
}