freescout/freescout-dist/app/Mail/Alert.php

51 lines
997 B
PHP
Raw Normal View History

2023-12-22 19:40:32 +00:00
<?php
namespace App\Mail;
use Illuminate\Mail\Mailable;
class Alert extends Mailable
{
/**
* Alert text.
*/
public $text;
/**
* Alert text.
*/
public $title;
/**
* Create a new message instance.
*/
public function __construct($text, $title = '')
{
$this->text = $text;
$this->title = $title;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
\MailHelper::prepareMailable($this);
$subject = '['.\Config::get('app.name').'] ';
if (!empty($this->title)) {
$subject .= $this->title;
} else {
// System emails are not translated
$subject .= 'Alert';
}
$subject .= ' - '.\Helper::getDomain();
$message = $this->subject($subject)
->view('emails/user/alert', ['text' => $this->text, 'title' => $this->title]);
return $message;
}
}