lundi 22 février 2016

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

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

e.g:

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

$schedule->command('another:command')
    ->daily();

I would like to display the list of scheduled commands and there frequency (as well as last/next run time, which I can log myself using the before/after functions).

However i'm stuck at the first hurdle. What i'm not sure how to do is get an array of the scheduled tasks that have been defined in Kernel.php

// Example function needs to be created
$tasks = getAllScheduledTasks();

@foreach($tasks as $task)
    <tr>
        <td>{{ $task->name }}</td>
        <td>{{ $task->description }}</td>
    </tr>
@endforeach

Simplified Question: How can I get an array of the scheduled tasks in Laravel?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1Oqo4S8
via IFTTT

Aucun commentaire:

Enregistrer un commentaire