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 93
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 101
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 109
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 120
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 131
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 139
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 147
FormBuilder
pause(string $message = 'Press enter to continue...', string|null $name = null)
Prompt the user to continue or cancel after pausing.
at line 157
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 168
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 178
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 188
FormBuilder
spin(Closure $callback, string $message = '', string|null $name = null)
Render a spinner while the given callback is executing.
at line 196
FormBuilder
note(string $message, string|null $type = null, string|null $name = null)
Display a note.
at line 204
FormBuilder
error(string $message, string|null $name = null)
Display an error.
at line 212
FormBuilder
warning(string $message, string|null $name = null)
Display a warning.
at line 220
FormBuilder
alert(string $message, string|null $name = null)
Display an alert.
at line 228
FormBuilder
info(string $message, string|null $name = null)
Display an informational message.
at line 236
FormBuilder
intro(string $message, string|null $name = null)
Display an introduction.
at line 244
FormBuilder
outro(string $message, string|null $name = null)
Display a closing message.
at line 255
FormBuilder
table(array|Collection $headers = [], array|Collection|null $rows = null, string|null $name = null)
Display a table.
at line 269
FormBuilder
progress(string $label, int|iterable $steps, Closure|null $callback = null, string $hint = '', string|null $name = null)
Display a progress bar.
at line 279
protected FormBuilder
runPrompt(callable $prompt, array $arguments, bool $ignoreWhenReverting = false)
Execute the given prompt passing the given arguments.