Scheduing progress
This commit is contained in:
parent
bb450e3a80
commit
2dfb12f23d
@ -30,9 +30,17 @@ public function handle(): void
|
|||||||
{
|
{
|
||||||
$maintenances = Maintenance::all();
|
$maintenances = Maintenance::all();
|
||||||
foreach ($maintenances as $maintenance) {
|
foreach ($maintenances as $maintenance) {
|
||||||
$cron = new CronExpression($maintenance->schedule);
|
$valid = CronExpression::isValidExpression($maintenance->schedule);
|
||||||
dump($cron->getNextRunDate(null, 2)->format('Y-m-d H:i:s'));
|
if (!$valid) {
|
||||||
|
dd($maintenance->schedule);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$cron = new CronExpression($maintenance->schedule);
|
||||||
|
if (!$cron->isDue('now')) {
|
||||||
|
dd($cron->getNextRunDate());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$maintenance->history()->create([
|
$maintenance->history()->create([
|
||||||
'start_at' => $cron->getNextRunDate(null, 2)
|
'start_at' => $cron->getNextRunDate(null, 2)
|
||||||
|
Loading…
Reference in New Issue
Block a user