Laravel задание, пропущенный параметр - PullRequest
0 голосов
/ 31 января 2020

Я пытаюсь отправить задание в Laravel.

Job:

    public $items;
    public $milestone_delivery_date;
    public $project_id;

    public function __construct($items, $milestone_delivery_date, $project_id)
    {
        $this->items = $items;
        $this->milestone_delivery_date = $milestone_delivery_date;
        $this->project_id = $project_id;
    }

PartController:

    public function storeImportedParts(Request $request, Project $project)
    {
        $milestones = $project->milestones->where('material_delivery', 1);

        $milestone_delivery_date = '';

        if ($milestones->count()) {
            $milestone_delivery_date = $milestones->first()->due_date;
        }

        $items = $request->items;

        $this->dispatch(new StoreImportedParts($items, $milestone_delivery_date, $project));

В этом случае возникает следующая ошибка :

[2020-01-31 08:23:16] local.ERROR: Too few arguments to function App\Jobs\StoreImportedParts::__construct(), 0 passed in /xxx/xx/xxx/xxx/app/Jobs/StoreImportedParts.php on line 37 and exactly 3 expected
???

Если я заменю переменные на числа, подобные этим, это сработает:

        $this->dispatch(new StoreImportedParts(1, 1,1));

Конечно, есть ошибка, но параметры приходят в задание:

[2020-01-31 08:24:02] local.ERROR: Invalid argument supplied for foreach() {"userId":2,"exception":"[object]

В PHPStorm дисплей также отличается:

enter image description here

enter image description here

Почему параметры не переходят в Иов?

...