【发布时间】:2015-04-11 18:04:17
【问题描述】:
我有两个模型 Shelf、Book 和 Quote
class Shelf extends Eloquent {
public function quotes()
{
return $this->belongsToMany('Book');
}
}
class Book extends Eloquent {
protected $touches = array('shelfs');
public function quotes()
{
return $this->belongsToMany('Quote');
}
public function shelfs()
{
return $this->belongsToMany('Shelf');
}
}
class Quote extends Eloquent {
protected $touches = array('books');
public function books()
{
return $this->belongsToMany('Book')->withTimestamps();
}
}
当我更新 Qoute 模型时,Qout 模型表中的 updated_at 会更新,但 Shelf 模型不会。
我做错了吗? 提前谢谢
【问题讨论】: