判断关注人列表,为什么不是 return $this->followings ()->contains ($user_id)?
<?php
namespace App\Models;
.
.
.
class User extends Authenticatable
{
.
.
.
public function isFollowing($user_id)
{
return $this->followings->contains($user_id);
}
}
为什么是 return $this->followings->contains($user_id);
而不是return $this->followings()->contains($user_id);
推荐文章: