Repeater ​
The repeater input type renders VInputRepeater, a dynamic form block that lets users add, remove, duplicate, and drag-to-reorder rows. Each row renders its own sub-form from the schema array. It is used for one-to-many relational data or repeatable JSON objects.
Hydrate ​
Class: RepeaterHydrateConfig type: repeaterOutput type: input-repeater → VInputRepeater
The hydrate:
- Sets
rootto'default'forrepeatertype, or to the original type name for subtypes (e.g.json-repeatersetsroot: 'json-repeater') - Sets
singularLabelfrom the singular oflabel - Sets
col.cols: 12for full-width layout - When
draggable: true, defaultsorderKeyto'position' - Auto-resolves foreign key fields in
schemawhenrepository,model, ornewConnectoris provided
Usage ​
Basic repeater ​
php
[
'type' => 'repeater',
'name' => 'contacts',
'label' => 'Contacts',
'singularLabel' => 'Contact',
'schema' => [
[
'type' => 'text',
'name' => 'name',
'label' => 'Name',
],
[
'type' => 'text',
'name' => 'email',
'label' => 'Email',
],
],
]Draggable with order key ​
php
[
'type' => 'repeater',
'name' => 'items',
'label' => 'Items',
'draggable'=> true,
'orderKey' => 'sort_order',
'schema' => [
['type' => 'text', 'name' => 'title', 'label' => 'Title'],
],
]Relational repeater with repository ​
Provide repository to let the hydrate auto-resolve foreign key fields inside schema:
php
[
'type' => 'repeater',
'name' => 'product_features',
'label' => 'Features',
'repository' => \App\Repositories\FeatureRepository::class,
'schema' => [
[
'type' => 'select',
'name' => 'feature_id',
'label' => 'Feature',
// items auto-resolved from repository
],
[
'type' => 'text',
'name' => 'value',
'label' => 'Value',
],
],
]Schema Defaults ​
| Key | Default | Description |
|---|---|---|
autoIdGenerator | true | Auto-assign IDs to new rows |
itemValue | 'id' | Field used as the row identifier |
itemTitle | 'name' | Field used as the row display title |
root | 'default' | Storage root key ('json-repeater' for JSON variant) |
col.cols | 12 | Always full width |
orderKey | 'position' | Sort key (only when draggable: true) |
See Also ​
- Json Repeater — Repeater that serialises rows as JSON objects
- Hydrates reference — Resolution table and schema contract