Display the next run time of tasks
This commit is contained in:
@@ -42,7 +42,7 @@ class ScheduleListCommand extends BaseCommand
|
||||
unset($task['instance']);
|
||||
return $task;
|
||||
}, $tasks);
|
||||
$this->io->table(['Schedule', 'Sprinkle', 'Name', 'Namespace'], $tasks);
|
||||
$this->io->table(['Schedule', 'Sprinkle', 'Name', 'Namespace', 'Next Run'], $tasks);
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ abstract class BaseTask implements TaskInterface
|
||||
*/
|
||||
public function nextRunDate($currentTime = 'now', $nth = 0, $allowCurrentDate = false)
|
||||
{
|
||||
return Date::instance((new CronExpression($this->getExpression()))
|
||||
return Date::instance((new CronExpression($this->expression))
|
||||
->getNextRunDate($currentTime, $nth, $allowCurrentDate, $this->timezone));
|
||||
}
|
||||
|
||||
|
||||
@@ -203,6 +203,8 @@ class Scheduler
|
||||
|
||||
$schedule = $taskClass->cronExpression();
|
||||
|
||||
$nextRun = $taskClass->nextRunDate();
|
||||
|
||||
// Build the class name and namespace
|
||||
return [
|
||||
'schedule' => $schedule,
|
||||
@@ -210,6 +212,7 @@ class Scheduler
|
||||
'name' => $name,
|
||||
'class' => $classPath,
|
||||
'instance' => $taskClass,
|
||||
'next_run' => $nextRun,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user