FormBuilder
class FormBuilder
Properties
| protected FormStep> | $steps | Each step that should be executed. |
|
| protected mixed[] | $responses | The responses provided by each step. |
Methods
Run all of the given steps.
Prompt the user to select an option.
Prompt the user to select multiple options.
Prompt the user to continue or cancel after pausing.
Prompt the user for text input with auto-completion.
Allow the user to search for multiple option.
Display a note.
Display an error.
Display a warning.
Display an alert.
Display an informational message.
Display an introduction.
Display a closing message.
Display a table.
Execute the given prompt passing the given arguments.
Details
at line 30
FormBuilder
add(Closure $step, string|null $name = null, bool $ignoreWhenReverting = false)
Add a new step.
at line 40
FormBuilder
addIf(bool|Closure $condition, Closure $step, string|null $name = null, bool $ignoreWhenReverting = false)
Add a new conditional step.
at line 52
array
submit()
Run all of the given steps.
at line 95
FormBuilder
text(string $label, string $placeholder = '', string $default = '', bool|string $required = false, mixed $validate = null, string $hint = '', string|null $name = null, Closure|null $transform = null)
Prompt the user for text input.
at line 103
FormBuilder
textarea(string $label, string $placeholder = '', string $default = '', bool|string $required = false, Closure|null $validate = null, string $hint = '', int $rows = 5, string|null $name = null, Closure|null $transform = null)
Prompt the user for multiline text input.
at line 111
FormBuilder
password(string $label, string $placeholder = '', bool|string $required = false, mixed $validate = null, string $hint = '', string|null $name = null, Closure|null $transform = null)
Prompt the user for input, hiding the value.
at line 122
FormBuilder
select(string $label, array|Collection $options, int|string|null $default = null, int $scroll = 5, mixed $validate = null, string $hint = '', bool|string $required = true, string|null $name = null, Closure|null $transform = null)
Prompt the user to select an option.
at line 133
FormBuilder
multiselect(string $label, array|Collection $options, array|Collection $default = [], int $scroll = 5, bool|string $required = false, mixed $validate = null, string $hint = 'Use the space bar to select options.', string|null $name = null, Closure|null $transform = null)
Prompt the user to select multiple options.
at line 141
FormBuilder
confirm(string $label, bool $default = true, string $yes = 'Yes', string $no = 'No', bool|string $required = false, mixed $validate = null, string $hint = '', string|null $name = null, Closure|null $transform = null)
Prompt the user to confirm an action.
at line 149
FormBuilder
pause(string $message = 'Press enter to continue...', string|null $name = null)
Prompt the user to continue or cancel after pausing.
at line 159
FormBuilder
suggest(string $label, array|Closure|Collection $options, string $placeholder = '', string $default = '', int $scroll = 5, bool|string $required = false, mixed $validate = null, string $hint = '', string|null $name = null, Closure|null $transform = null)
Prompt the user for text input with auto-completion.
at line 170
FormBuilder
search(string $label, Closure $options, string $placeholder = '', int $scroll = 5, mixed $validate = null, string $hint = '', bool|string $required = true, string|null $name = null, Closure|null $transform = null)
Allow the user to search for an option.
at line 180
FormBuilder
multisearch(string $label, Closure $options, string $placeholder = '', int $scroll = 5, bool|string $required = false, mixed $validate = null, string $hint = 'Use the space bar to select options.', string|null $name = null, Closure|null $transform = null)
Allow the user to search for multiple option.
at line 190
FormBuilder
spin(Closure $callback, string $message = '', string|null $name = null)
Render a spinner while the given callback is executing.
at line 198
FormBuilder
note(string $message, string|null $type = null, string|null $name = null)
Display a note.
at line 206
FormBuilder
error(string $message, string|null $name = null)
Display an error.
at line 214
FormBuilder
warning(string $message, string|null $name = null)
Display a warning.
at line 222
FormBuilder
alert(string $message, string|null $name = null)
Display an alert.
at line 230
FormBuilder
info(string $message, string|null $name = null)
Display an informational message.
at line 238
FormBuilder
intro(string $message, string|null $name = null)
Display an introduction.
at line 246
FormBuilder
outro(string $message, string|null $name = null)
Display a closing message.
at line 257
FormBuilder
table(array|Collection $headers = [], array|Collection|null $rows = null, string|null $name = null)
Display a table.
at line 271
FormBuilder
progress(string $label, int|iterable $steps, Closure|null $callback = null, string $hint = '', string|null $name = null)
Display a progress bar.
at line 281
protected FormBuilder
runPrompt(callable $prompt, array $arguments, bool $ignoreWhenReverting = false)
Execute the given prompt passing the given arguments.