fixed email notification
This commit is contained in:
parent
481f19305b
commit
41b6489c0a
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user