ldc-legaulois/app/Notifications/Customer/DestroyedCustomer.php

63 lines
1.8 KiB
PHP
Raw Permalink Normal View History

2024-07-05 16:34:57 +02:00
<?php
namespace App\Notifications\Customer;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
2024-07-05 16:34:57 +02:00
use Illuminate\Notifications\Messages\MailMessage;
2026-09-25 16:25:31 +02:00
use Illuminate\Notifications\Notification;
use Symfony\Component\Mime\Email;
2024-07-05 16:34:57 +02:00
class DestroyedCustomer extends Notification implements ShouldQueue
2024-07-05 16:34:57 +02:00
{
use Queueable;
public $tries = 3;
2026-10-19 11:16:32 +02:00
/**
* The customer firstname.
*
* @var string
*/
protected $firstname;
public function __construct(string $firstname)
{
$this->firstname = $firstname;
}
2024-07-05 16:34:57 +02:00
/**
* Get the notification's delivery channels.
*
* @return array<int, string>
*/
public function via(): array
2024-07-05 16:34:57 +02:00
{
return ['mail'];
}
/**
* Build the mail representation of the notification.
*/
public function toMail(object $notifiable): MailMessage
2024-07-05 16:34:57 +02:00
{
return (new MailMessage())
->view([
'html' => 'notifications::email-club',
'text' => 'notifications::email-club-text',
])
2024-07-05 16:34:57 +02:00
->subject(trans('Votre compte est suprimé - :site_name', [
2026-09-25 16:25:31 +02:00
'site_name' => config('app.name'),
2024-07-05 16:34:57 +02:00
]))
2026-10-19 11:16:32 +02:00
->greeting(trans('Bonjour :name,', ['name' => $this->firstname]))
2024-07-05 16:34:57 +02:00
->line(trans(
"Votre compte :site_name a été définitivement supprimé ainsi ques les données associés,
si vous aviez effectué une commande elle sera bien sûr toujours honorée. Les commandes associés
a votre compte continueront d'exister mais les données de votre compte ont bien été supprimées.",
['site_name' => config('app.name')]
))->withSymfonyMessage(function (Email $message) {
$message->html($message->getHtmlBody(), 'utf-8');
});
2024-07-05 16:34:57 +02:00
}
}