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时间戳 .
我有一种情况需要让它反转,比如Post update会自动更新该帖子的评论update_at .
无论如何使用Eloquent ORM进行此操作?