feat: Add email verification notification with queued processing for user model
This commit is contained in:
parent
a12e516b2d
commit
a4b83ed6cb
@ -5,6 +5,7 @@
|
|||||||
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||||
|
|
||||||
use App\Enums\UserStatus;
|
use App\Enums\UserStatus;
|
||||||
|
use App\Notifications\VerifyEmailQueued;
|
||||||
use Dyrynda\Database\Support\CascadeSoftDeletes;
|
use Dyrynda\Database\Support\CascadeSoftDeletes;
|
||||||
use Illuminate\Auth\Passwords\CanResetPassword;
|
use Illuminate\Auth\Passwords\CanResetPassword;
|
||||||
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||||
@ -46,6 +47,11 @@ protected function casts(): array
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function sendEmailVerificationNotification()
|
||||||
|
{
|
||||||
|
$this->notify(new VerifyEmailQueued);
|
||||||
|
}
|
||||||
|
|
||||||
#[Scope]
|
#[Scope]
|
||||||
protected function active(Builder $query): void
|
protected function active(Builder $query): void
|
||||||
{
|
{
|
||||||
|
|||||||
26
app/Notifications/VerifyEmailQueued.php
Normal file
26
app/Notifications/VerifyEmailQueued.php
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Notifications;
|
||||||
|
|
||||||
|
use Illuminate\Auth\Notifications\VerifyEmail;
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use Illuminate\Notifications\Messages\MailMessage;
|
||||||
|
|
||||||
|
class VerifyEmailQueued extends VerifyEmail implements ShouldQueue
|
||||||
|
{
|
||||||
|
use Queueable;
|
||||||
|
|
||||||
|
public function toMail($notifiable): MailMessage
|
||||||
|
{
|
||||||
|
$verificationUrl = $this->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'));
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user