AI store generator for ecommerce, Malaysia first. Laravel 13 + React + TypeScript.
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

OrderConfirmation.php 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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\Address;
  7. use Illuminate\Mail\Mailables\Content;
  8. use Illuminate\Mail\Mailables\Envelope;
  9. use Illuminate\Queue\SerializesModels;
  10. /**
  11. * Sent to the shopper once their order is paid. Written in the store's language.
  12. */
  13. class OrderConfirmation extends Mailable
  14. {
  15. use Queueable, SerializesModels;
  16. public function __construct(public Order $order) {}
  17. public function envelope(): Envelope
  18. {
  19. $store = $this->order->store;
  20. return new Envelope(
  21. // Sent from our address (so it is delivered), but under the store's name, with replies going to the store.
  22. from: new Address((string) config('mail.from.address'), $store->name),
  23. replyTo: $store->contact_email !== null ? [new Address($store->contact_email, $store->name)] : [],
  24. subject: $store->language->value === 'ms'
  25. ? "Pesanan #{$this->order->number} disahkan - {$store->name}"
  26. : "Order #{$this->order->number} confirmed - {$store->name}",
  27. );
  28. }
  29. public function content(): Content
  30. {
  31. $store = $this->order->store;
  32. $brand = StoreBrand::for($store);
  33. return new Content(
  34. // In the store's own colours, fonts and corners, so shoppers see the shop they bought from.
  35. view: 'mail.orders.confirmation',
  36. text: 'mail.orders.confirmation-text',
  37. with: [
  38. 'order' => $this->order->loadMissing('items'),
  39. 'store' => $store,
  40. 'brand' => $brand,
  41. 'orderUrl' => $brand->orderUrl($this->order),
  42. 'whatsappUrl' => $brand->whatsappUrl($this->order),
  43. ],
  44. );
  45. }
  46. }