Using the Laravel task scheduler I have created a number of tasks in app/Console/Kernel.php
e.g:
$schedule->command('some:command')
->daily();
$schedule->command('another:command')
->daily();
I would like to display the list of scheduled commands, their frequency, and last/next run time on a dashboard but I'm not sure how I can get the list of scheduled events. Is there a way to do this?
There's actually no support out of the box for this, unfortunately. What you'll have to do is extend the
artisan schedulecommand and add alistfeature. Thankfully there's a simple class you can run:This will provide you with a
php artisan schedule:list. Now that's not exactly what you need, but then you can easily get this list from within your Laravel stack by executing:And that will provide you with a list of the schedule commands.
Of course, don't forget to inject the
Facade:use Illuminate\Support\Facades\Artisan;