Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

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);
 
PREVIOUS NEXT
Tagged: #laravel #search #user #details #specific #role
ADD COMMENT
Topic
Name
3+8 =