Last active
November 9, 2017 16:20
-
-
Save jozefcipa/68e7aeb5cd649625d3897200591c09b7 to your computer and use it in GitHub Desktop.
Sending exceptions in Laravel to mail
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// app/Mail/ExceptionOccured.php | |
namespace App\Mail; | |
use Illuminate\Bus\Queueable; | |
use Illuminate\Mail\Mailable; | |
use Illuminate\Queue\SerializesModels; | |
class ExceptionOccured extends Mailable | |
{ | |
use Queueable, SerializesModels; | |
protected $exceptionHtml; | |
/** | |
* Create a new message instance. | |
* | |
* @param $exceptionHtml | |
* @internal param Exception $e | |
*/ | |
public function __construct($exceptionHtml) | |
{ | |
$this->exceptionHtml = $exceptionHtml; | |
} | |
/** | |
* Build the message. | |
* | |
* @return $this | |
*/ | |
public function build() | |
{ | |
return $this->subject('Exception occured !') | |
->view('mail.exception') | |
->with('exceptionHtml', $this->exceptionHtml); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment