diff --git a/app/Abstracts/Notification.php b/app/Abstracts/Notification.php index 8570df2d6..9ea25d0eb 100644 --- a/app/Abstracts/Notification.php +++ b/app/Abstracts/Notification.php @@ -2,6 +2,7 @@ namespace App\Abstracts; +use App\Models\Common\EmailTemplate; use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Notifications\Notification as BaseNotification; @@ -34,26 +35,24 @@ abstract class Notification extends BaseNotification */ public function initMessage() { + $template = EmailTemplate::alias($this->template)->first(); + $message = (new MailMessage) ->from(config('mail.from.address'), config('mail.from.name')) - ->subject($this->getSubject()) - ->view('partials.email.body', ['body' => $this->getBody()]); + ->subject($this->getSubject($template)) + ->view('partials.email.body', ['body' => $this->getBody($template)]); return $message; } - public function getSubject() + public function getSubject($template) { - $content = setting('email.' . $this->template . '_subject'); - - return $this->replaceTags($content); + return $this->replaceTags($template->subject); } - public function getBody() + public function getBody($template) { - $content = setting('email.' . $this->template . '_body'); - - return $this->replaceTags($content); + return $this->replaceTags($template->body); } public function replaceTags($content)