「サブスクリプション」と呼ばれる Post と User の間に hasAndBelongsToMany 関係があります。(post_users の代わりに) user_id と post_id が含まれます。
動作していますが、Post モデルのフィールドを更新すると、Subscriptions テーブルからレコードが削除されます。なぜこうなった?
更新はこれです(私のPostモデルで):
public function markAsRead(){
$this->read(null, $this->id);
$this->set('user_read', 1);
return $this->save();
}
ありがとう。