Apr 14, 2016
0
Level 2
Romanbican roles - get all users with role
Hi I'm looking for a query to get all users with certain role. Using laravel 5.2 together with romanbican/roles.
What I have tried:
$clients = User::with('roles')->where('role', 'client')->get();
$clients = User::whereHas('roles', function($q) { $q->where('name', 'client'); })->get();
And some others I cannot remember, but none of them seem to work unfortunately.
Can anyone help me with this?
Please or to participate in this conversation.