events(); $commandNames = []; foreach ($commands as $command) { $commandNames[] = $command->command ?? $command->getSummaryForDisplay(); } $index = array_search($this->choice('Which command would you like to run?', $commandNames), $commandNames); $event = $commands[$index]; $this->line('['.date('c').'] Running scheduled command: '.$event->getSummaryForDisplay()); $event->run($this->laravel); } }