-
-
Notifications
You must be signed in to change notification settings - Fork 86
Repeater
tanthammar edited this page Sep 26, 2020
·
12 revisions
- Used for array fields. Usually stored in a
json
db column. - Do not forget to
$cast
the field to array on the model.
Extends BaseField
You can use all field types except: 'array', 'keyval', 'repeater', 'checkboxes', 'multiselect'
and 'spatie-tags'
in the KeyVal field.
Makes the array sortable. Show buttons to change the order of the array items. (See the image)
- Applied to the outer wrapper surrounding the Repeater field group
- Default:
'flex flex-col divide-y mb-2 rounded border'
- Defines the css grid for the Repeater field group
- Default:
'flex-1 sm:grid sm:grid-cols-12 gap-x-2'
Repeater::make('Friends')->fields([
Input::make('First name')
->afterLabel('After Label slot')
->rules('required')
->colspan(6),
Input::make('Last name')
->afterLabel('Best slot to display field help')
->colspan(6)
->rules('required'),
])->sortable()
->help('Click plus to add a friend'),
])
There is no blade component for the Repeater field, it is a plain blade view that wraps each field.
Apart from dynamic styling mentioned above, these options in the config file relates to the Repeater field.
config('tall-forms.field-attributes.repeater-wrapper')
config('tall-forms.field-attributes.repeater-wrapper-grid')
You can also set the icons for the buttons in the config file.
//icons
'arrow-up-icon' => 'light/arrow-up', //used as @svg('light/arrow-up', 'classes')
'arrow-down-icon' => 'light/arrow-down',
'trash-icon' => 'light/trash-alt',
- Installation
- Requirements
- v5 Upgrade Guide
- v6 Upgrade Guide
- v7 Upgrade Guide
- Support
- Quickstart
- Manual installation
- Optional
- Form component
- Field
- Field types
- Example Form
- Blade Components
- Notifications