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 105
FormBuilder
textarea(string $label, string $placeholder = '', string $default = '', bool|string $required = false, mixed $validate = null, string $hint = '', int $rows = 5, string|null $name = null, Closure|null $transform = null)
Prompt the user for multiline text input.
Unlike Laravel's ?Closure, $validate accepts validation rules, as the textarea() helper and the other prompts do.
at line 113
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 124
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 135
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 143
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 151
FormBuilder
pause(string $message = 'Press enter to continue...', string|null $name = null)
Prompt the user to continue or cancel after pausing.
at line 161
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 172
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 182
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 192
FormBuilder
spin(Closure $callback, string $message = '', string|null $name = null)
Render a spinner while the given callback is executing.
at line 200
FormBuilder
note(string $message, string|null $type = null, string|null $name = null)
Display a note.
at line 208
FormBuilder
error(string $message, string|null $name = null)
Display an error.
at line 216
FormBuilder
warning(string $message, string|null $name = null)
Display a warning.
at line 224
FormBuilder
alert(string $message, string|null $name = null)
Display an alert.
at line 232
FormBuilder
info(string $message, string|null $name = null)
Display an informational message.
at line 240
FormBuilder
intro(string $message, string|null $name = null)
Display an introduction.
at line 248
FormBuilder
outro(string $message, string|null $name = null)
Display a closing message.
at line 259
FormBuilder
table(array|Collection $headers = [], array|Collection|null $rows = null, string|null $name = null)
Display a table.
at line 273
FormBuilder
progress(string $label, int|iterable $steps, Closure|null $callback = null, string $hint = '', string|null $name = null)
Display a progress bar.
at line 283
protected FormBuilder
runPrompt(callable $prompt, array $arguments, bool $ignoreWhenReverting = false)
Execute the given prompt passing the given arguments.