ldc-boutique-cnc-sable/app/Mail/OrderConfirmAdminMail.php
2026-10-27 09:58:12 +01:00

69 lines
1.6 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Mail;
use Domain\Events\AnOrderHasBeenPlaced;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Support\Facades\Config;
class OrderConfirmAdminMail extends Mailable implements ShouldQueue
{
use Queueable;
/**
* Create a new message instance.
*/
public function __construct(
private readonly AnOrderHasBeenPlaced $orderEvent
) {
}
public function retryUntil(): \DateTimeInterface
{
return $this->orderEvent->pickupDay;
}
/**
* Get the message envelope.
*/
public function envelope(): Envelope
{
return new Envelope(
subject: trans('New order from :firstname :lastname - :appname', [
'firstname' => $this->orderEvent->employee->firstname,
'lastname' => $this->orderEvent->employee->lastname,
'appname' => Config::string('app.name'),
]),
);
}
/**
* Get the message content definition.
*/
public function content(): Content
{
return new Content(
markdown: 'emails.order-confirm-admin',
with: [
'order' => $this->orderEvent,
'magasin' => $this->orderEvent->shop,
],
);
}
/**
* Get the attachments for the message.
*
* @return \Illuminate\Mail\Mailables\Attachment[]
*/
public function attachments(): array
{
return [];
}
}