MarcosGenolet
TCTwill CMS
•Created by MarcosGenolet on 12/1/2024 in #👊support
Repeater with input and browser, how to save data!?
Hi! I have a repeater that contains 1 text input (name="credit")and a browser to select items from another related model called Author.
The relationship between Audiovisual and Author is belongsToMany. The pivot table contains a credit column for the input field information.
Visually it works, but I don't know what to do in the repository, inside afterSave and getFormFields, I try a thousand ways and I can't save the info, I'm going crazy!
I appreciate any help you can give me!!!!
I share the code of the repeater:
//in AudiovisualController.php
$form->add(
Repeater::make()->type('authorcredits')
);
//in views/twill/repeaters/authorcredits.blade.php
@twillRepeaterTitle('Author')
@twillRepeaterTitleField('name', ['hidePrefix' => true])
@twillRepeaterTrigger('Add author')
@twillRepeaterGroup('app')
<x-twill::input
name="credit"
label="Crédito"
:required="true"
/>
<x-twill::browser
module-name="authors"
name="author"
label="Authors"
:max="4"
/>
5 replies