F
Filamentβ€’2mo ago
Patrick

Trigger form + relationship save method in custom action?

How can I save the form and all relationships in my custom action ? I want to manually call what "Save changes" button does.
3 Replies
Dennis Koch
Dennis Kochβ€’2mo ago
For Relationship fields there is a saveRelationshipUsing() method. Otherwise that's the default for the form builder.
toeknee
toekneeβ€’2mo ago
if you have the relationships in the model, then surely just adding ->model(MyModel) to the form will suffice?
Patrick
Patrickβ€’2mo ago
Thanks for your replies and help! It worked with $form->saveRelationships() in my custom action. I was missing to use($form) in my custom action and so had no access to saveRelationships() Thanks πŸ™‚