Я пытаюсь отправить электронное письмо с классом работы в Ларавеле, дело в том, что мне нужно отслеживать уведомления, отправленные по почте. У меня есть таблица с именем «уведомлений», которая имеет статус столбцов и последующую срок (это та, что касается этой проблемы). Эта модель представляет собой «уведомления» < /p>
Мой вопрос здесь: сохраняются ли параметры внутри класса вакансий в следующем вызове после их изменения из класса? Видимо не работает так. Если это невозможно, может ли кто -нибудь предложить обходной путь? < /P>
class SendReminderEmail extends Job implements ShouldQueue
{
use InteractsWithQueue, SerializesModels;
public function __construct($lastNotification)
{
$this->lastNotification = $lastNotification;
}
//NULL means it's the first time the job has been called
protected $lastNotification;
public function handle(Mailer $mailer)
{
$mailer->send('user.welcome', ['username' => 'Luis Manuel'], function($message)
{
$message->from('mymail@mymail.com', 'Luis');
$message->to('mymail@mymail.com', 'mymail@mymail.com');
$message->subject('Subject here!');
});
if(count($mailer->failures()) > 0)
{
if($this->lastNotification == null)
{
$this->lastNotification = new Notification;
$this->lastNotification->status = false;
$this->lastNotification->lastUpdated = Carbon::now();
}
else
{
$this->lastNotification->status = false;
$this->lastNotification->lastUpdated = Carbon::now();
}
$this->lastUpdated->save();
}
}
}
Подробнее здесь: https://stackoverflow.com/questions/358 ... -job-class