在 Laravel 10 中,我尝试在 Kernel 类中安排多个命令。他们使用相同的命令类/签名,但发送不同的参数。我想我已经正确遵循了文档并且我已经尝试了两种格式。
内核:
$schedule->command('import:markers Texas')->everyMinute();
OR
$schedule->command(ImportMarkers::class, ['Texas'])->everyMinute();
这按预期工作:
php artisan import:markers Texas
但是使用调度程序,我收到两种命令类型的失败消息:
php artisan schedule:run
2023-10-25 21:08:51 Running ['artisan' import:markers Texas] ......... 1,999ms FAIL
⇂ '/opt/homebrew/Cellar/php/8.2.4/bin/php' 'artisan' import:markers Texas > '/dev/null' 2>&1
我错过了什么?
这是您在内核中定义计划命令的方式。
protected function schedule(Schedule $schedule)
{
$schedule->command('import:markers', ['Texas'])->everyMinute();
}