option('batch'), FILTER_VALIDATE_INT, ['options' => ['min_range' => 1, 'max_range' => 1000]]); if ($batch === false) { $this->error('Batch must be between 1 and 1000'); return self::FAILURE; } if ($this->option('dry-run')) { DB::beginTransaction(); try { $counts = $backfill->run($batch); } finally { DB::rollBack(); } $this->line(json_encode(['dry_run' => true, 'rolled_back' => true, 'counts' => $counts], JSON_THROW_ON_ERROR)); } else { $this->line(json_encode($backfill->run($batch), JSON_THROW_ON_ERROR)); } return self::SUCCESS; } }