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/OrderReceivedAdminMail.php
<?php

namespace App\Mail;

use App\Komma\Locations\Models\Location;
use App\Komma\Orders\Models\Order;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log;

class OrderReceivedAdminMail extends Mailable
{
    use Queueable, SerializesModels;

    /** @var Order */
    private $order;

    /** @var Location */
    private $location;

    /** @var array */
    private $sendTo;

    public bool $savedToTeamleader;

    public array $messages;

    /**
     * Create a new message instance.
     *
     * @return void
     */
    public function __construct(Order $order, Location $location, bool $savedToTeamleader, array $messages)
    {
        $this->order = $order;
        $this->location = $location;
        $this->savedToTeamleader = $savedToTeamleader;
        $this->messages = $messages;

        $sendTo = ($location->country === 'BE' ? ['info@farmfun.be'] : ['info@farmfun.nl']);
        if (! in_array($location->email, $sendTo)) {
            $sendTo[] = $location->email;
        }

//        Log::warning(self::class . ': Mailed to; ' . site_config('mailTo') . ' en ' . $location->email);
//        Log::info(config('mail'));
//        Log::info('');

        $this->sendTo = $sendTo;
    }

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {
        return $this->view('emails.admin.orderReceived')
            ->to($this->sendTo)
            ->subject($this->order->order_reservation_number.' | '.__('site/email.order_received_admin.subject').' | '.config('site.company.name'))
            ->with([
                'order' => $this->order,
                'location' => $this->location,
            ]);
    }
}