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 Koch9mo ago
For Relationship fields there is a saveRelationshipUsing() method. Otherwise that's the default for the form builder.
toeknee
toeknee9mo ago
if you have the relationships in the model, then surely just adding ->model(MyModel) to the form will suffice?
Patrick
PatrickOP9mo 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 🙂

Did you find this page helpful?