ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
``` //查询用户的粉丝 $fans = $user\->fans; $fusers = User::alias('u') ->join('profile p', 'u.id = p.user\_id') ->when($keyword, function ($query) use ($keyword) { $query\->where('p.nickname', 'like', "%{$keyword}%"); }) ->withCount(\['articles', 'fans'\],false) ->whereIn('u.id', $fans ->column('fan\_id')) ->where('u.status', 1) ->paginate([ 'list_rows' => $this->pagesize, 'query' => \[ 'keyword' => $keyword, \] \]); ``` 关键点在于 withCount 第二个参数要为false