| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
-
- namespace App\Mail;
-
- use App\Models\Order;
- use Illuminate\Bus\Queueable;
- use Illuminate\Mail\Mailable;
- use Illuminate\Mail\Mailables\Content;
- use Illuminate\Mail\Mailables\Envelope;
- use Illuminate\Queue\SerializesModels;
-
- /**
- * Sent to the shopper once their order is paid. Written in the store's language.
- */
- class OrderConfirmation extends Mailable
- {
- use Queueable, SerializesModels;
-
- public function __construct(public Order $order) {}
-
- public function envelope(): Envelope
- {
- $store = $this->order->store;
-
- return new Envelope(
- subject: $store->language->value === 'ms'
- ? "Pesanan #{$this->order->number} disahkan - {$store->name}"
- : "Order #{$this->order->number} confirmed - {$store->name}",
- );
- }
-
- public function content(): Content
- {
- return new Content(
- markdown: 'mail.orders.confirmation',
- with: [
- 'order' => $this->order->loadMissing('items'),
- 'store' => $this->order->store,
- 'malay' => $this->order->store->language->value === 'ms',
- 'money' => fn (int $sen): string => 'RM '.number_format($sen / 100, 2),
- ],
- );
- }
- }
|