2020-05-27 16:37:55 +08:00
|
|
|
<?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')) {
|
2020-08-31 19:48:31 +08:00
|
|
|
$url = URL::signedRoute('auth.verify', ['user' => $user->uid], null, false);
|
2020-05-27 16:37:55 +08:00
|
|
|
|
|
|
|
try {
|
|
|
|
Mail::to($user->email)->send(new EmailVerification(url($url)));
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
report($e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|