TA/web_JMW/app/Notifications/LoginOtpNotification.php

42 lines
1.1 KiB
PHP

<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class LoginOtpNotification extends Notification
{
use Queueable;
public function __construct(private readonly string $otp)
{
}
/**
* Get the notification's delivery channels.
*
* @return array<int, string>
*/
public function via(object $notifiable): array
{
return ['mail'];
}
/**
* Get the mail representation of the notification.
*/
public function toMail(object $notifiable): MailMessage
{
return (new MailMessage)
->subject('Kode OTP Login JMW Showroom')
->greeting('Halo ' . $notifiable->username . ',')
->line('Gunakan kode OTP berikut untuk menyelesaikan login Anda:')
->line($this->otp)
->line('Kode ini berlaku selama 5 menit.')
->line('Jika Anda tidak mencoba login, abaikan email ini.')
->salutation('Salam, Tim JMW Showroom');
}
}