AI store generator for ecommerce, Malaysia first. Laravel 13 + React + TypeScript.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace App\Mail;
  3. use App\Models\Order;
  4. use Illuminate\Bus\Queueable;
  5. use Illuminate\Mail\Mailable;
  6. use Illuminate\Mail\Mailables\Content;
  7. use Illuminate\Mail\Mailables\Envelope;
  8. use Illuminate\Queue\SerializesModels;
  9. /**
  10. * Sent to the shopper once their order is paid. Written in the store's language.
  11. */
  12. class OrderConfirmation extends Mailable
  13. {
  14. use Queueable, SerializesModels;
  15. public function __construct(public Order $order) {}
  16. public function envelope(): Envelope
  17. {
  18. $store = $this->order->store;
  19. return new Envelope(
  20. subject: $store->language->value === 'ms'
  21. ? "Pesanan #{$this->order->number} disahkan - {$store->name}"
  22. : "Order #{$this->order->number} confirmed - {$store->name}",
  23. );
  24. }
  25. public function content(): Content
  26. {
  27. return new Content(
  28. markdown: 'mail.orders.confirmation',
  29. with: [
  30. 'order' => $this->order->loadMissing('items'),
  31. 'store' => $this->order->store,
  32. 'malay' => $this->order->store->language->value === 'ms',
  33. 'money' => fn (int $sen): string => 'RM '.number_format($sen / 100, 2),
  34. ],
  35. );
  36. }
  37. }