/** * Interactively ask the user to enter currencies * * @return array */ protected function askCurrencies() { $this->showCurrenciesList(); $answer = $this->ask("Enter 'all' or a space separated list of ids/codes to enable: "); if (trim($answer) === 'all') { return $this->allCurrencies->pluck('id')->all(); } // Filter input $answer = array_map('strtoupper', array_filter(array_map('trim', explode(' ', $answer)))); // Loop until the user enters something if (!$answer) { return $this->askCurrencies(); } return $answer; }