where('type', RegistryType::MANAGED->value) ->when($this->argument('registry'), fn ($query) => $query->whereKey((int) $this->argument('registry'))) ->get(); $count = 0; foreach ($registries as $registry) { $operation = $operations->execute($registry); $count++; if ($this->option('dispatch')) { $operation->steps()->orderBy('order')->first()?->dispatchJob(); } } $this->info("Created {$count} managed registry maintenance operation(s)."); return self::SUCCESS; } }