W.r.t laravel doc #Touching Parent Timestamps
class Comment extends Eloquent
{
protected $touches = array('post'); // my concern with "touches"
public function post()
{
return $this->belongsTo('Post');
}
}
因此,当评论模型更新时,会自动触摸拥有帖子的updated_at时间戳。
我有一种情况需要让它反向,比如发布更新后自动更新评论的那篇帖子的update_at。
无论如何使用Eloquent ORM进行此操作?