Update parent "updated_at"

How can I update parent "updated_at", if I modify repeters relationships field?
5 Replies
toeknee
toeknee3y ago
How are you updating the relationship? updated_at should be part of the model and any change to the model will update it accordingly?
AlexAnder
AlexAnderOP3y ago
In main model Survey I have relationship answers, answers are edited in SurveyResource repeater->relationships. Edited field belongs to answer, but I want that, Survey updated_at also changes
toeknee
toeknee3y ago
Ok, but if nothing has changed in the parent that's not easily updatable, you would need to adjust it to handle a manual update as part of the action
AlexAnder
AlexAnderOP3y ago
Ok, tHanks. Completely forrgotten about Laravel model
protected $touches = ['survey'];
protected $touches = ['survey'];
toeknee
toeknee3y ago
Perfectly done

Did you find this page helpful?