fixed email notification
This commit is contained in:
parent
481f19305b
commit
41b6489c0a
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Abstracts;
|
namespace App\Abstracts;
|
||||||
|
|
||||||
|
use App\Models\Common\EmailTemplate;
|
||||||
use Illuminate\Notifications\Messages\MailMessage;
|
use Illuminate\Notifications\Messages\MailMessage;
|
||||||
use Illuminate\Notifications\Notification as BaseNotification;
|
use Illuminate\Notifications\Notification as BaseNotification;
|
||||||
|
|
||||||
@ -34,26 +35,24 @@ abstract class Notification extends BaseNotification
|
|||||||
*/
|
*/
|
||||||
public function initMessage()
|
public function initMessage()
|
||||||
{
|
{
|
||||||
|
$template = EmailTemplate::alias($this->template)->first();
|
||||||
|
|
||||||
$message = (new MailMessage)
|
$message = (new MailMessage)
|
||||||
->from(config('mail.from.address'), config('mail.from.name'))
|
->from(config('mail.from.address'), config('mail.from.name'))
|
||||||
->subject($this->getSubject())
|
->subject($this->getSubject($template))
|
||||||
->view('partials.email.body', ['body' => $this->getBody()]);
|
->view('partials.email.body', ['body' => $this->getBody($template)]);
|
||||||
|
|
||||||
return $message;
|
return $message;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSubject()
|
public function getSubject($template)
|
||||||
{
|
{
|
||||||
$content = setting('email.' . $this->template . '_subject');
|
return $this->replaceTags($template->subject);
|
||||||
|
|
||||||
return $this->replaceTags($content);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getBody()
|
public function getBody($template)
|
||||||
{
|
{
|
||||||
$content = setting('email.' . $this->template . '_body');
|
return $this->replaceTags($template->body);
|
||||||
|
|
||||||
return $this->replaceTags($content);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function replaceTags($content)
|
public function replaceTags($content)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user