How Can I Stop the Relationship from Auto-Saving After Submitting the Form

Hello everyone, basically I just want to retrieve the data from a form and save it as a JSON object in the database after the user submits the form. However, due to the relationship relationship(name: 'services', titleAttribute: 'name'), the pivot table is automatically updated after submitting the form. How can I stop this? Thank you!
2 Replies
LeandroFerreira
LeandroFerreira5mo ago
If you want to save it manually, add dehydrated() in the repeater after relationship()
Moe Tarhini
Moe TarhiniOP5mo ago
Table Action : Tables\Actions\EditAction::make() ->before(function (array $data, Domain $record, $action): array { dd($record->services);
}); Inside the From : Select::make('services')->native(false)->preload() ->helperText(fn (Get $get, $livewire) => renderHelperTextDomainForm::renderHelperTextForInactiveServices($livewire, $get('services'))) ->relationship(name: 'services', titleAttribute: 'name') ->dehydrated() I really don't know what I'm doing wrong, after the dd($record->services) is launched the services record is already has been updated in the db !
Want results from more Discord servers?
Add your server