entrust icon indicating copy to clipboard operation
entrust copied to clipboard

count users assigned to roles

Open ajoudh opened this issue 7 years ago • 1 comments

Basically I just want to count users based on there roles, something like this:

roles          count

 admin              4
 user                 2
$role_name     $User_withthisRole_count

not sure what to do..

ajoudh avatar Aug 25 '18 12:08 ajoudh

Here is something i personally use: User::whereHas('roles', function($query) { $query->where('id', 1); })->count() to count users based on roles.

mariusberget92 avatar Mar 11 '19 19:03 mariusberget92