laravel job 队列参数传递和获取问题

控制器里往队列里添加任务代码是这样的

public function queTest(){
    $user = Users::findOrFail(1);
    $job = (new MyTest($user))->onQueue('myTest');
    $this->dispatch($job);
    echo 'success';
}

我是用打datebase做队列驱动的,添加到队列以后 payload字段内容是这样的

{"job":"Illuminate\\Queue\\CallQueuedHandler@call","data":{"command":"O:15:\"App\\Jobs\\MyTest\":4:{s:10:\"connection\";N;s:5:\"queue\";s:6:\"myTest\";s:5:\"delay\";N;s:6:\"\u0000*\u0000job\";N;}"}

然后我的job执行的代码是这样的

public function __construct(Users $users)
{
    $this->name = $users->name;
    $this->id = $users->id;
}
public function handle( Request $request )
{
    $action_records = new ActionRecords();
    $action_records->user_id = $this->id;
    $action_records->action_content = $this->name;
    $action_records->save();
}

然后队列执行起来以后就会报错

Undefined property: App\Jobs\MyTest::$id

就是初始化的参数队列拿不到,敢问大家这样的问题是什么原因造成的

kenjz
修改的评论也不能少于六个字哦!