Use the $touches property to update the parent timestamp when a child is updated.
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
class Comment extends Model
{
protected $touches = ['post'];
public function post()
{
return $this->belongs To (Post::class);
}
}
PHP