1
0
Fork 0
mirror of https://github.com/archtechx/laravel-tips.git synced 2025-12-12 05:14:04 +00:00
laravel-tips/content/tips/use-the-touches-property-to-update-the-parent-timestamp-when-a-child-is-updated.md
Samuel Štancl 4af817e2b0 Week 10
2022-03-12 23:01:24 +01:00

585 B

title tweet_id thread_slug author_username images created_at slug
Use the $touches property to update the parent timestamp when a child is updated 1502367773288468480 weekly-thread-2022-10 cosmeescobedo
https://pbs.twimg.com/media/FNDZSoCUYAYIRo_.jpg
2022-03-11T19:36:04+00:00 use-the-touches-property-to-update-the-parent-timestamp-when-a-child-is-updated

🔥 #Laravel Did you know you can update the parent model timestamp when a child is updated?

If you have a "belongsTo" or "belongsToMany" relationship you can define a "$touches" property to do this.