📌  相关文章
📜  laravel 关注和取消关注关系 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:52.607000             🧑  作者: Mango

代码示例1
// users that are followed by this user
public function following() {
    return $this->belongsToMany(User::class, 'followers', 'follower_id', 'following_id');
}

// users that follow this user
public function followers() {
    return $this->belongsToMany(User::class, 'followers', 'following_id', 'follower_id');
}