HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/farmfun/reserveren.farmfun.be/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,
            ]);
    }
}