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

44 lines
1.1 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Notifications;
use Domain\Events\AnOrderHasBeenPlaced;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class OrderConfirmed extends Notification implements ShouldQueue
{
use Queueable;
public function __construct(
private readonly AnOrderHasBeenPlaced $orderEvent
) {
}
public function retryUntil(): \DateTimeInterface
{
return $this->orderEvent->pickupDay;
}
/** @return string[] */
public function via(object $notifiable): array
{
return ['mail'];
}
public function toMail(object $notifiable): MailMessage
{
$order = $this->orderEvent;
$shop = $order->shop;
return new MailMessage()
->subject(trans('Your order - :appname', [
'appname' => config()->string('app.name'),
]))
->markdown('emails.order-confirm', compact('order', 'shop'));
}
}