我想在滚动滚动时加载更多用户,但是姓氏的orWhere会造成干扰,如果我删除orWhere,工作正常,返回下一个用户...
public function users_more($last_id) {
$users = User::where('name', 'like', '%' . $_POST['search_data'] . '%')
->orWhere('lastname', 'like', '%' . $_POST['search_data'] . '%')
->orderBy('id', 'desc')->where('id', '<', $last_id)
->with(['userProfile' => function($query) {
$query->select('count_followers', 'user_id');
}])->orderBy('name', 'desc')
->take(6)
->get();
return view("site.list.header.search.usersmore", compact('users'));
}
用户表示:
10
9
8
7
接下来显示:
10
9
8
7
应该显示:
6
5
4