讨论数量:
举个例子来说,花花(id:1) 朵朵(id:2) ,如果2个用户相互关注,我们的可以去粉丝数据表中和关注数据表中查询where
如果两个用户的2都存在,证明就是互相关注了,不过使用多态关联处理更好一些。可以参照下Laravel
手册
public function matualFollowing()
{
return $this->followings->intersect($this->followers);
}
可以这样来获取互相关注的集合。 :pensive:
推荐文章: