Страницы · Laravilt
CheckboxColumn
Configure a checkbox for a boolean table column.
php
The cell shows a checkbox. Checking or unchecking it saves the new value 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 is always validated as required|boolean, and your rules() are added after that. It's stored as true or false.
Hooks and disabling
beforeStateUpdated() and afterStateUpdated() receive the record, the column name, and the new value:
php
A disabled checkbox is read-only, and the endpoint rejects updates to it.
API reference
| Method | Description |
|---|---|
beforeStateUpdated() | Before-update hook |
afterStateUpdated() | After-update hook |
rules() | Validation rules, added after required and boolean |
disabled() | Make the checkbox read-only |