Laravel 排队时通知不起作用

Laravel Notification doesn't work when queued

当用户添加新笔记时,我正在使用通知向管理员发送电子邮件。如果我不使用 ShouldQueue,一切正常。当我使用队列时出现错误

错误异常:未定义属性:App\Notifications\NewKidNote::$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)
        ];
    }
}

自我注意..确保清理缓存并重新启动队列:))然后它就可以正常工作了!这段代码运行完美。谢谢