Skip to content

how to list all users based on their groups #611

Answered by lonnieezell
ahmaruff asked this question in Q&A
Discussion options

You must be logged in to vote

Bonfire has implemented this as part of a filter, but here's the relevant code which would translate to something like:

$users = $userModel
    ->select('users.*)
    ->join('auth_groups_users agu', 'agu.user_id = users.id')
    ->whereIn('agu.group', 'superadmin')
    ->findAll();

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@ahmaruff
Comment options

Answer selected by ahmaruff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants