diff --git a/app/Console/Commands/LegacyBudgetGroupShiftCommand.php b/app/Console/Commands/LegacyBudgetGroupShiftCommand.php index d091b755..7b09fbdb 100644 --- a/app/Console/Commands/LegacyBudgetGroupShiftCommand.php +++ b/app/Console/Commands/LegacyBudgetGroupShiftCommand.php @@ -18,7 +18,7 @@ class LegacyBudgetGroupShiftCommand extends Command public function handle(): void { \DB::transaction(function () { - $latestPlan = LegacyBudgetPlan::all()->last(); + $latestPlan = LegacyBudgetPlan::orderBy('id', 'desc')->limit(1)->first(); $budgetGroups = LegacyBudgetGroup::where('hhp_id', $latestPlan->id) ->where('id', '>=', $this->argument('new_group_id')); $this->info('The following amount of other groups will be shifted back: '.$budgetGroups->count());