1
0
Fork 0
mirror of https://github.com/archtechx/laravel-tips.git synced 2025-12-12 21:34:03 +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

13 lines
No EOL
585 B
Markdown

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