考虑以下代码
$schedule->command('products:update')->name('Update products')->daily()->after(function() {
// how do I get the name here?
});
如何在闭包内访问命令的名称(“ products:update”或“ Update products”)?
答案 0 :(得分:0)
我认为它的工作在控制台的内核文件中。
protected $commands = [
'App\Console\Commands\PopulateGoogleService'
];
$schedule->command('PopulateGoogleService')->weekly()->sundays()->at('02:00')
->timezone('Asia/Kolkata')
->sendOutputTo(storage_path('logs/cron.log'));