假设我要调度三个命令:
'commandA','commandB'和'commandC'
但是我不想在“commandA”完成之前运行“commandB”,并且我不想在“commandB”完成之前运行“commandC”。
我知道我可以安排每五分钟运行一次:
$schedule->command('commandA')->everyFiveMinutes();
$schedule->command('commandB')->everyFiveMinutes();
$schedule->command('commandC')->everyFiveMinutes();
但是可以将它们一个接一个地链接吗?
最佳答案
使用then(Closure $callback)链接命令:
$schedule->command('commandA')->everyFiveMinutes()->then(function() {
$this->call('commandB');
$this->call('commandC');
});
关于php - Laravel Artisan Scheduler中的链命令?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/29825483/