Cascade inputs describe 1:n relationships as subforms. These subforms contain data of the related models and users can freely add, remove and sort elements connected to the main model.
Subforms are described the same way as simple forms are. A cascade input expects the related model to have a similar .yaml configuration to what any main form would have. For more details, check the Creating list and form configs section of the documentation.
The 1:n relationships handled by the cascade input type have to be set up properly according to the Laravel specs. GreenLight recommends to use Reliese to generate models, as relationships also get automatically generated that way.
|model||The 'n' part of the 1:n relationship (class name, either fully qualified or under the GreenLight namespace)|
|sortable||Setting true makes tabs sortable, requires an integer field in the subform|
|titleKey||Name of the field to use for tab titles (keep in mind that FK values are not handled correctly yet)|
Gallery form config - gallery.yaml:
gallery_images: type: cascade name: Képek parameters: model: GalleryImage sortable: true
GalleryImage form config - gallery_image.yaml:
id: type: text name: ID parameters: readonly: true image_src: type: file name: Kép title: type: text name: Név description: type: textEditor name: Leírás sequence: type: int name: Sorrend parameters: readonly: true created_at: type: text name: Létrehozva parameters: disabled: true updated_at: type: text name: Módosítva parameters: disabled: true