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/ASmits/kemi.nl/app/Mail/AdminError.php
<?php

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Http\Request;
use Illuminate\Queue\SerializesModels;

class AdminError extends ConfigurableMailable
{
    use Queueable, SerializesModels;

    /**@var \Illuminate\Http\Request */
    private $request;

    /** @var \Exception */
    private $exception;
    /**
     * @var int
     */
    private $httpStatusCode;

    /**
     * Create a new message instance that represents a mail containing information about an exception
     *
     * @param \Illuminate\Http\Request $request
     * @param \Exception $exception
     * @param int $httpStatusCode
     */
    public function __construct(Request $request, \Exception $exception, int $httpStatusCode)
    {
        $this->request = $request;
        $this->exception = $exception;
        $this->httpStatusCode = $httpStatusCode;
        parent::__construct();
    }

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {
        //Prepare Exception for mailing
        $requestUri = strtolower($this->request->getRequestUri());
        $stackTrace = (string) $this->exception;
        $errorMessage = $this->exception->getMessage();

        //Build a subject
        $subject = $this->httpStatusCode.' fout op '.$this->request->getHost();

        //Set from and to
        $this->from(\Config::get('mail.from.address'), \Config::get('mail.from.name'));
        $this->to(\Config::get('mail.admin.address'))->subject($subject);

        //And return a view for the message
        return $this->view('emails.admin-error', [
            'request' => $this->request,
            'requestUri' => $requestUri,
            'stackTrace' => $stackTrace,
            'code' => $this->httpStatusCode,
            'errorMessage' => $errorMessage
        ]);
    }
}