sendEmailNotificationToAdminMailable.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace App\Mail;
  3. use App\Shop\Addresses\Transformations\AddressTransformable;
  4. use App\Shop\Orders\Order;
  5. use Illuminate\Bus\Queueable;
  6. use Illuminate\Mail\Mailable;
  7. use Illuminate\Queue\SerializesModels;
  8. use Illuminate\Contracts\Queue\ShouldQueue;
  9. class sendEmailNotificationToAdminMailable extends Mailable
  10. {
  11. use Queueable, SerializesModels, AddressTransformable;
  12. public $order;
  13. /**
  14. * Create a new message instance.
  15. * @param Order $order
  16. */
  17. public function __construct(Order $order)
  18. {
  19. $this->order = $order;
  20. }
  21. /**
  22. * Build the message.
  23. *
  24. * @return $this
  25. */
  26. public function build()
  27. {
  28. $data = [
  29. 'order' => $this->order,
  30. 'products' => $this->order->products,
  31. 'customer' => $this->order->customer,
  32. 'courier' => $this->order->courier,
  33. 'address' => $this->order->address,
  34. 'status' => $this->order->orderStatus,
  35. 'payment' => $this->order->paymentMethod
  36. ];
  37. return $this->view('emails.admin.OrderNotificationEmail', $data);
  38. }
  39. }