LARAVEL: Get an array of scheduled tasks for output in admin dashboard

前端 未结 3 1609
深忆病人
深忆病人 2020-12-16 17:51

Using the Laravel task scheduler I have created a number of tasks in Kernel.php

e.g:

$schedule->command(\'some:command\')
    ->daily();

$sche         


        
3条回答
  •  天涯浪人
    2020-12-16 18:34

    As your not running through the console you need to invoke the schedule method on the Kernel in your controller... (don't forget to make the schedule method public instead of protected).

    public function index(\Illuminate\Contracts\Console\Kernel $kernel, \Illuminate\Console\Scheduling\Schedule $schedule)
    {
        $kernel->schedule($schedule);
        dd($schedule->events());
    }
    

提交回复
热议问题