ldc-crm/app/Mail/ExceptionAlert.php
2021-08-04 13:13:30 +02:00

49 lines
1.2 KiB
PHP

<?php
namespace App\Mail;
use Exception;
use Illuminate\Mail\Mailable;
class ExceptionAlert extends Mailable
{
/**
* Undocumented variable
*
* @var Exception
*/
public $exception;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct(Exception $exception)
{
$this->exception = $exception;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
return $this->view('mail.exception')
->subject('Need help !, an error occured in your application, please check Logs ASAP')
->text('mail.exception-plain')
->with('appName', config('app.name'))
->with('appUrl', config('app.url'))
->with('exception', $this->exception)
->with('url', app()->runningInConsole() ? 'CONSOLE' : (
(request() and request()->fullUrl()) ?
request()->fullUrl() : 'none'))
->to(
config('mail.contactsList.serviceweb', 'informatique.internet@ldc.fr'),
sprintf('%s Exception Handler', config('app.name'))
);
}
}