diff --git a/src/Illuminate/Console/Concerns/ConfiguresPrompts.php b/src/Illuminate/Console/Concerns/ConfiguresPrompts.php index da05a397a1da..7bca27f45376 100644 --- a/src/Illuminate/Console/Concerns/ConfiguresPrompts.php +++ b/src/Illuminate/Console/Concerns/ConfiguresPrompts.php @@ -3,6 +3,7 @@ namespace Illuminate\Console\Concerns; use Laravel\Prompts\ConfirmPrompt; +use Laravel\Prompts\MultiSearchPrompt; use Laravel\Prompts\MultiSelectPrompt; use Laravel\Prompts\PasswordPrompt; use Laravel\Prompts\Prompt; @@ -87,6 +88,32 @@ function () use ($prompt) { false, $prompt->validate )); + + MultiSearchPrompt::fallbackUsing(fn (MultiSearchPrompt $prompt) => $this->promptUntilValid( + function () use ($prompt) { + $query = $this->components->ask($prompt->label); + + $options = ($prompt->options)($query); + + if ($prompt->required === false) { + if (array_is_list($options)) { + return collect($this->components->choice($prompt->label, ['None', ...$options], 'None', multiple: true)) + ->reject('None') + ->values() + ->all(); + } + + return collect($this->components->choice($prompt->label, ['' => 'None', ...$options], '', multiple: true)) + ->reject('') + ->values() + ->all(); + } + + return $this->components->choice($prompt->label, $options, multiple: true); + }, + $prompt->required, + $prompt->validate + )); } /**