From a4b83ed6cb0b13783886beed278d3b3fc6fe6f97 Mon Sep 17 00:00:00 2001 From: Yoga Pangestu Date: Sat, 28 Feb 2026 17:21:11 +0700 Subject: [PATCH] feat: Add email verification notification with queued processing for user model --- app/Models/User.php | 6 ++++++ app/Notifications/VerifyEmailQueued.php | 26 +++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 app/Notifications/VerifyEmailQueued.php diff --git a/app/Models/User.php b/app/Models/User.php index fdc46da..a8913ae 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -5,6 +5,7 @@ // use Illuminate\Contracts\Auth\MustVerifyEmail; use App\Enums\UserStatus; +use App\Notifications\VerifyEmailQueued; use Dyrynda\Database\Support\CascadeSoftDeletes; use Illuminate\Auth\Passwords\CanResetPassword; use Illuminate\Contracts\Auth\MustVerifyEmail; @@ -46,6 +47,11 @@ protected function casts(): array ]; } + public function sendEmailVerificationNotification() + { + $this->notify(new VerifyEmailQueued); + } + #[Scope] protected function active(Builder $query): void { diff --git a/app/Notifications/VerifyEmailQueued.php b/app/Notifications/VerifyEmailQueued.php new file mode 100644 index 0000000..2a1f006 --- /dev/null +++ b/app/Notifications/VerifyEmailQueued.php @@ -0,0 +1,26 @@ +verificationUrl($notifiable); + + return (new MailMessage) + ->subject('Verifikasi Alamat Email') + ->greeting('Halo, '.$notifiable->customer->name.'!') + ->line('Klik tombol di bawah ini untuk memverifikasi alamat email Anda.') + ->action('Verifikasi Email', $verificationUrl) + ->line('Jika Anda tidak membuat akun, abaikan email ini.') + ->salutation('Salam, '.config('app.name')); + } +}