📅  最后修改于: 2022-03-11 14:54:43.201000             🧑  作者: Mango
$search_query = $request->search_query;
$role = 'Member';
$results = User::with('roles')->whereHas("roles", function($q) use($role){
$q->where('title', '=', $role);
})->where('name', 'LIKE', "%{$search_query}%")->paginate(4);