ldc-boutique-cnc/app/Mail/OrderStatusMail.php

49 lines
932 B
PHP
Raw Permalink Normal View History

2021-04-14 10:39:20 +02:00
<?php
namespace App\Mail;
2021-04-21 17:50:57 +02:00
use App\Models\Magasin;
2022-09-03 16:56:16 +02:00
use App\Models\Order;
2021-04-14 10:39:20 +02:00
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
class OrderStatusMail extends Mailable
{
2022-08-25 12:26:43 +02:00
use Queueable;
use SerializesModels;
2021-04-14 10:39:20 +02:00
2022-09-03 16:56:16 +02:00
/**
* The Order
*
* @var \App\Models\Order
*/
2021-04-14 10:39:20 +02:00
private $order;
/**
* Create a new message instance.
*
2022-09-03 16:56:16 +02:00
* @param \App\Models\Order $order
2021-04-14 10:39:20 +02:00
* @return void
*/
2022-09-03 16:56:16 +02:00
public function __construct(Order $order)
2021-04-14 10:39:20 +02:00
{
$this->order = $order;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
2022-08-25 12:26:43 +02:00
$order = $this->order;
$magasin = Magasin::find($order->timeslot->magasin->id);
2021-04-21 17:50:57 +02:00
2022-09-03 16:56:16 +02:00
return $this->subject(
"Votre commande - " . config('theme.site_name')
)->view('mails.order-status', compact('order', 'magasin'));
2021-04-14 10:39:20 +02:00
}
}