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" />
4 Replies
Amira
Amira3w ago
Hi , did u try to add this into ur Auiovisial repo protected $browsers = [ "{repeatername}" => [ 'relation' => '{relation}', 'moduleName' => '"{modulenmae}' ],]; and update the repeater inside after save the code mentioned here https://twillcms.com/docs/form-fields/repeater.html#content-blade-repeater-fields
Twill
MarcosGenolet
MarcosGenoletOP3w ago
thank you. The $protect.. code is inside the Model?. I'm a little bit confused.
Amira
Amira2w ago
MarcosGenolet
MarcosGenoletOP2w ago
Thanks @Amira
Want results from more Discord servers?
Add your server