Display the next run time of tasks

This commit is contained in:
2022-04-28 16:04:17 +01:00
parent f77098d11b
commit ea722e2023
3 changed files with 5 additions and 2 deletions

View File

@@ -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;
}

View File

@@ -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));
}

View File

@@ -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,
];
}
}