ldc-legaulois/app/Notifications/Customer/UpdatePassword.php
2026-10-19 15:49:33 +02:00

65 lines
1.8 KiB
PHP

<?php
namespace App\Notifications\Customer;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use Symfony\Component\Mime\Email;
class UpdatePassword extends Notification implements ShouldQueue
{
use Queueable;
public $tries = 3;
/**
* The customer firstname.
*
* @var string
*/
protected $firstname;
public function __construct(string $firstname)
{
$this->firstname = $firstname;
}
/**
* Get the notification's delivery channels.
*
* @return array<int, string>
*/
public function via(): array
{
return ['mail'];
}
/**
* Get the mail representation of the notification.
*/
public function toMail(object $notifiable): MailMessage
{
return (new MailMessage())
->view([
'html' => 'notifications::email-club',
'text' => 'notifications::email-club-text',
])
->subject(trans('Mise à jour du mot de passe - :site_name', [
'site_name' => config('app.name'),
]))
->greeting(trans('Bonjour :name,', ['name' => $this->firstname]))
->line(trans(
"Le mot de passe associé à votre compte :strong sur le Club des Gaulois :endStrong vient d'être modifié.",
[
'strong' => '<strong>',
'endStrong' => '</strong>',
]
))
->action(trans('Me connecter au club'), route('club.login'))
->withSymfonyMessage(function (Email $message) {
$message->html($message->getHtmlBody(), 'utf-8');
});
}
}