I have a hasAndBelongsToMany relation between Post and User called "Subscriptions". (instead of posts_users) It contains the user_id and the post_id.
I have it working but when i update a field of the Post model, then the record is deleted from the Subscriptions table. Why is this happening?
The update is this (at my Post model):
public function markAsRead(){
$this->read(null, $this->id);
$this->set('user_read', 1);
return $this->save();
}
Thanks.