File: D:/HostingSpaces/SBogers10/netwerkbrabant.komma.pro/app/Mail/PaymentErrorMail.php
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Http\Request;
use Illuminate\Queue\SerializesModels;
class PaymentErrorMail extends ConfigurableMailable
{
use Queueable, SerializesModels;
/**@var Request */
private $request;
/** @var \Exception */
private $exception;
/**
* Create a new message instance that represents a mail containing information about an exception
*
* @param Request $request
* @param \Exception $exception
* @param int $httpStatusCode
*/
public function __construct(Request $request, \Exception $exception)
{
$this->request = $request;
$this->exception = $exception;
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 = 'Payment error mail';
//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
$data = [
'request' => $this->request,
'requestUri' => $requestUri,
'stackTrace' => $stackTrace,
'errorMessage' => $errorMessage
];
return $this->view('emails.paymentError', $data);
}
}