File: D:/HostingSpaces/SBogers10/farmfun.komma.pro/app/Mail/ChangedReservationAdminMail.php
<?php
namespace App\Mail;
use App\Komma\Orders\OrderService;
use App\Komma\Reservations\Models\Reservation;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
class ChangedReservationAdminMail extends Mailable
{
use Queueable, SerializesModels;
private $reservation;
private $order;
/** @var array */
private $sendTo;
/** @var array */
private $changedLog;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct(Reservation $reservation, array $changedLog)
{
$this->reservation = $reservation;
$this->changedLog = $changedLog;
$sendTo = [site_config('mailTo')];
if (! in_array($reservation->location->email, $sendTo)) {
$sendTo[] = $reservation->location->email;
}
/** @var OrderService $orderService */
$orderService = app()->make(OrderService::class);
$this->order = $orderService->createFakeOrderFromReservation($reservation);
$this->sendTo = $sendTo;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
return $this->view('emails.admin.changedReservation')
->to($this->sendTo)
->subject($this->reservation->reservation_number.' | '.__('site/email.reservation_changed_admin.subject').' | '.config('site.company.name'))
->with([
'reservation' => $this->reservation,
'changedLog' => $this->changedLog,
'order' => $this->order,
'location' => $this->reservation->location,
]);
}
}