ldc-gen-game-web/app/Notifications/Customer/UpdateEmail.php

48 lines
1.4 KiB
PHP

<?php
namespace App\Notifications\Customer;
use App\Models\Settings;
use Illuminate\Notifications\Notification;
use Illuminate\Notifications\Messages\MailMessage;
class UpdateEmail extends Notification
{
/**
* Get the notification's delivery channels.
*
* @param object $notifiable
* @return array<int, string>
* @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
*/
public function via(object $notifiable): array
{
// phpcs:enable
return ['mail'];
}
/**
* Get the mail representation of the notification.
*
* @param object $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail(object $notifiable): MailMessage
{
/** @var \App\Models\Settings */
$settings = app(Settings::class);
/** @var \App\Models\Customer $notifiable */
/** @var string $first_name */
$first_name = $notifiable->api_data->firstname;
return (new MailMessage())
->subject(trans('Mise à jour de l\'email - :site_name', [
'site_name' => $settings->name
]))
->greeting(trans('Bonjour :first_name', ['first_name' => $first_name]))
->line(trans('L\'email associé à votre compte :site_name vient d\'être modifié.', [
'site_name' => $settings->name
]));
}
}