mirror of
https://github.com/archtechx/laravel-tips.git
synced 2025-12-12 05:14:04 +00:00
13 lines
No EOL
585 B
Markdown
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. |