Download the PHP package pavloniym/nova-checkbox-matrix without Composer
On this page you can find all versions of the php package pavloniym/nova-checkbox-matrix. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package nova-checkbox-matrix
Nova Checkbox Matrix
A Laravel Nova 5 field that renders a rows × columns checkbox matrix — for example people × roles.
- Sticky header and first column, horizontal scroll on narrow screens
- Per-row avatar (with initials fallback), label and subtitle
- Client-side search over rows (case-insensitive, Unicode-aware)
- Selected-count badge in each column header
- Light and dark themes
- Works on resource forms, detail and index pages, and in actions
- Server-side normalization: unknown rows/columns sent by the client are discarded
- Typed value objects in and out — no domain assumptions
Installation
The service provider is auto-discovered.
Usage
Everything is configured through small value objects: MatrixRow, MatrixColumn and MatrixOptions.
The submitted value comes back as a MatrixValue of MatrixSelections.
Reading the value
fields() is evaluated again when an action runs, so the submitted value is normalized against the same rows and columns.
On a resource
Store the value in a JSON column cast to array. MatrixValue serializes to {"<rowKey>": ["<columnKey>", ...]}
and the field resolves stored JSON back into a MatrixValue.
Fullscreen actions
In an action opened with ->fullscreen() the matrix takes the viewport height and keeps its header sticky.
Value guarantees
- Only declared row keys and column keys are kept, everything else sent by the client is dropped.
- Columns are ordered as declared; duplicates are removed.
- Rows without any checked column are omitted.
- When the request does not contain the attribute at all, the model attribute is left untouched.
API
| Object | Method | Description |
|---|---|---|
CheckboxMatrix |
rows(iterable<MatrixRow>) |
Rows in display order |
columns(iterable<MatrixColumn>) |
Columns in display order | |
options(MatrixOptions) |
Display options | |
MatrixRow |
make($key, $label) |
$key is cast to string |
subtitle(?string) / caption(?string) |
Second and third line | |
avatar(?string) |
Absolute http(s) URL; anything else is ignored |
|
MatrixColumn |
make($key, $label) |
$key is cast to string |
MatrixOptions |
searchable(), avatars(), subtitles(), captions(), counters() |
Toggle UI parts |
MatrixValue |
selections(), forRow(), isEmpty(), toArray(), fromArray(), empty() |
Submitted value |
MatrixSelection |
rowKey, columnKeys |
Checked columns of one row |
Translations
The component uses Nova's __() helper with these keys: Search, No rows, No results found. Add them to your lang/{locale}.json to translate.
Development
dist/ is committed so consumers do not need a JS toolchain.
License
MIT