Answers for "laravel search user details by specific role"

PHP
0

laravel search user details by specific role

$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);
Posted by: Guest on June-20-2021

Code answers related to "laravel search user details by specific role"

Browse Popular Code Answers by Language