如果用户关注或不关注页面,我正试图获取。我这样想:
public function get_following()
{
return $this->belongsTo(Followers::class, 'user_id')->where('type', '=', 1)->where('follower_id', '=', auth()->user()->id);
}
但是这返回null并且我按照这个页面(得到了表上的项目)...
DD($页)
Page {#305 ▼
#relations: array:3 [▼
"ptag" => Tag {#309 ▶}
"get_following" => null
"links" => Collection {#318 ▶}
]
DB:
followers.user_id = (pages.id), follower_id = (auth user), type = (1)