Created
September 16, 2020 11:18
-
-
Save ponich/19ac06f0d0c5cd83ee71b9bc85b7b8d0 to your computer and use it in GitHub Desktop.
Detect mailable class for laravel
This file contains 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 | |
namespace App\Mail; | |
use Illuminate\Contracts\Mail\Mailer as MailerContract; | |
use Illuminate\Mail\Mailable as BaseMailable; | |
abstract class Mailable extends BaseMailable | |
{ | |
public function send(MailerContract $mailer) | |
{ | |
$this->withSwiftMessage(function ($message) { | |
$message->mailable = get_class($this); | |
}); | |
parent::send($mailer); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment