繁体   English   中英

Laravel-Artisan :: call()不接受参数

[英]Laravel - Artisan::call() doesn't take argument

我正在使用Laravel 5.4和PHP 7.0。

我要重新排队的表中有很多失败的工作。 我编写了一个脚本来浏览从数据库中提取的ID列表,并且我希望foreach重新排队每个ID。 很简单的东西。

我的问题是当我跑步时

foreach($jobsToRetry as $failedJob) {
    Artisan::call('queue:retry '.$failedJob);
}

我收到以下错误:

Command "queue:retry 1" is not defined.

Did you mean one of these?
    queue:failed
    queue:failed-table
    queue:flush
    queue:forget
    queue:listen
    queue:restart
    queue:retry
    queue:table
    queue:work

它需要使用命令“ queue:retry”并将参数分开,但我只是不知道如何使它工作。

在参数中给出参数

Artisan::call('queue:retry', ['id' => $failedJob]);

您应该尝试这样:

Artisan::call('queue:retry', ['--yourparameter' => $failedJob]);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM