Laravel通知不存在';排队时不能工作

Laravel通知不存在';排队时不能工作,laravel,queue,Laravel,Queue,当用户添加新便笺时,我使用通知向管理员发送电子邮件。如果我不使用ShouldQueue,一切都可以。。当我使用队列时,我得到一个错误 ErrorException:未定义的属性:App\Notifications\newkynote::$note 原因可能是什么? 这是我的通知代码 <?php namespace App\Notifications; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQ

当用户添加新便笺时,我使用通知向管理员发送电子邮件。如果我不使用ShouldQueue,一切都可以。。当我使用队列时,我得到一个错误

ErrorException:未定义的属性:App\Notifications\newkynote::$note

原因可能是什么? 这是我的通知代码

<?php

namespace App\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use App\Models\KidNote;

class NewKidNote extends Notification
{
    use Queueable;

    protected $note;
    protected $kidname;
    protected $userfullname;
    protected $color;
    protected $sentnote;
    protected $kidid;

    public function __construct($note)
    {
        $this->note          = $note;
        $this->kidname       = $note->kid->name;
        $this->userfullname  = $note->user->fullname;
        $this->color         = $note->color;
        $this->sentnote      = $note->note;
        $this->kidid         = $note->kid_id;
    }

    public function via($notifiable)
    {
        return ['mail','database'];
    }

    public function toMail($notifiable)
    {
        return (new MailMessage)
              ->subject('New Note added')
              ->greeting('Hello ')
              ->line('New Note has been added for '. $this->kidname. ' by '.$this->userfullname)
              ->line('Note Color: '.$this->color)
              ->line('Note')
              ->line($this->sentnote)
              ->action('You can also see the note here', route('admin.children.show',$this->kidid));
    }
    
    public function toDatabase($notifiable)
    {
        return [
           'icon'    => 'notepad',
           'color'   => $this->color,
           'message' => 'New note added for '. $this->kidname ,
           'link'    => route('admin.children.show',$this->kidid)
        ];
    }
}

自我说明。。请确保清理缓存并重新启动队列:),然后它就可以正常工作了!!这段代码运行得很好。谢谢

您如何称呼此活动?请出示。为什么需要这个->节点=$node?在任何地方你都可以使用$admin->notify(新的NewKindote($note));我就是这么叫它的。为什么需要
$this->node=$node
?您将节点模型所有数据设置为通知类属性我在实现shouldqueue之前使用的属性。。它不会引起任何问题,我使用它时也没有。