Laravel 5.1 до обратного вызова не работает

В планировщике задач в Laravel 5.1 до обратного вызова не работает:

protected function schedule(Schedule $schedule)
{
$schedule->command('inspire')->hourly();
$schedule->command('view:clear')->daily();
$schedule->call(function(){
ToolsController::fixCategory();
})
->everyMinute()
->before(function () {
// Task is about to start...
Log::info('Start fixing Category');
})
->after(function () {
// Task is complete...
Log::info('End fixing Category');
});

}

В файле журнала:

[2015-12-04 12:02:22] local.INFO: End fixing Category
[2015-12-04 12:06:08] local.INFO: End fixing Category

Любая идея ?

1

Решение

Спасибо за @Svetlio

Командный класс:

class FixCategory extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'FixCategory';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Fix Category';

/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
ToolsController::fixCategory();
}
}

Класс ядра:

class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
\App\Console\Commands\Inspire::class,
\App\Console\Commands\FixCategory::class,
];

/**
* Define the application's command schedule.
*
* @param  \Illuminate\Console\Scheduling\Schedule  $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
$schedule->command('inspire')->hourly();
$schedule->command('view:clear')->daily();
$schedule->command('FixCategory')
->everyMinute()
->before(function () {
// Task is about to start...
Log::info('Start fixing Category');
})
->after(function () {
// Task is complete...
Log::info('End fixCategory');
});
}
}

Журнальный файл:

[2015-12-04 12:44:49] local.INFO: Start fixing Category
[2015-12-04 12:44:50] local.INFO: End fixing Category
1

Другие решения

Других решений пока нет …

По вопросам рекламы [email protected]