diff --git a/app/Console/Commands/RecurringCheck.php b/app/Console/Commands/RecurringCheck.php index df5c9f305..f29cf3ce0 100644 --- a/app/Console/Commands/RecurringCheck.php +++ b/app/Console/Commands/RecurringCheck.php @@ -40,7 +40,7 @@ class RecurringCheck extends Command config(['laravel-model-caching.enabled' => false]); // Get all recurring - $recurring = Recurring::allCompanies()->with('company')->cursor(); + $recurring = Recurring::allCompanies()->with('company')->get(); $this->info('Creating recurring records ' . $recurring->count()); @@ -112,6 +112,11 @@ class RecurringCheck extends Command foreach ($schedules as $schedule) { $schedule_date = Date::parse($schedule->getStart()->format('Y-m-d')); + // Don't recur the future + if ($schedule_date->greaterThan($today)) { + continue; + } + $this->recur($model, $recur->recurable_type, $schedule_date); } }