libra/app/Notifications/PasswordResetByAdminNotific...

56 lines
1.3 KiB
PHP

<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class PasswordResetByAdminNotification extends Notification implements ShouldQueue
{
use Queueable;
public function __construct(
public string $newPassword
) {}
/**
* 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
{
$locale = $notifiable->preferred_language ?? 'ar';
return (new MailMessage)
->subject(__('emails.password_reset_by_admin_subject', [], $locale))
->view('emails.password-reset-by-admin', [
'user' => $notifiable,
'newPassword' => $this->newPassword,
'locale' => $locale,
]);
}
/**
* Get the array representation of the notification.
*
* @return array<string, mixed>
*/
public function toArray(object $notifiable): array
{
return [
'type' => 'password_reset_by_admin',
];
}
}