Страницы · Laravilt
SelectColumn
Configure a select dropdown for a table column.
The cell shows a dropdown. Picking an option saves it to the record straight away. See Editable columns for how the save is authorized and validated.
Inline editing requires Laravilt v1.1 or later.
The value must be one of the option keys. With selectablePlaceholder() (the default), the dropdown also has an empty entry, and choosing it stores null. Your rules() are added after those checks.
Options
selectablePlaceholder(false) removes the empty entry and makes a value required.
The bundled tables always render a styled dropdown and ignore
native(). They don't applydisableOptionWhen()either, and neither does the update endpoint. To block a value, add a rule, such as->rules([\Illuminate\Validation\Rule::notIn(['archived'])]).
Hooks and disabling
API reference
| Method | Description |
|---|---|
options() | Array or closure of options |
optionsSearchable() | Searchable options |
native() | Use a native <select> (ignored by the bundled tables) |
selectablePlaceholder() | Allow selecting the empty placeholder (stores null). Default true |
disableOptionWhen() | Disable individual options (not enforced by the bundled tables) |
placeholder() | Label of the empty entry |
rules() | Validation rules, added after the option check |
disabled() | Make the dropdown read-only |
beforeStateUpdated(), afterStateUpdated() | Update hooks |