AI store generator for ecommerce, Malaysia first. Laravel 13 + React + TypeScript.
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

PaymentReminder.php 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. * "Complete your payment": sent once to a shopper who placed an order but left the payment page without paying
  12. * (PaymentDoubleCheck). Written in the store's language.
  13. */
  14. class PaymentReminder extends Mailable
  15. {
  16. use Queueable, SerializesModels;
  17. public function __construct(public Order $order) {}
  18. public function envelope(): Envelope
  19. {
  20. $store = $this->order->store;
  21. return new Envelope(
  22. // Sent from our address (so it is delivered), but under the store's name, with replies going to the store.
  23. from: new Address((string) config('mail.from.address'), $store->name),
  24. replyTo: $store->contact_email !== null ? [new Address($store->contact_email, $store->name)] : [],
  25. subject: $store->language->value === 'ms'
  26. ? "Lengkapkan bayaran untuk pesanan #{$this->order->number} - {$store->name}"
  27. : "Complete your payment for order #{$this->order->number} - {$store->name}",
  28. );
  29. }
  30. public function content(): Content
  31. {
  32. $store = $this->order->store;
  33. $brand = StoreBrand::for($store);
  34. return new Content(
  35. // In the store's own colours, fonts and corners, so shoppers see the shop they ordered from.
  36. view: 'mail.orders.payment-reminder',
  37. text: 'mail.orders.payment-reminder-text',
  38. with: [
  39. 'order' => $this->order->loadMissing('items'),
  40. 'store' => $store,
  41. 'brand' => $brand,
  42. 'payUrl' => $brand->payUrl($this->order),
  43. 'orderUrl' => $brand->orderUrl($this->order),
  44. 'deadline' => $this->order->payment_expires_at
  45. ?->timezone('Asia/Kuala_Lumpur')
  46. ->locale($brand->malay ? 'ms' : 'en')
  47. ->translatedFormat('j F, g:i a'),
  48. ],
  49. );
  50. }
  51. }