Reputation: 1083
I have used Entrust for Laravel 5, and I am creating a page in the admin where it displays all the users with 'customers' role. From the documentation, I know how to get a user's role but what I want is to get all the users that has the same roles.
Upvotes: 0
Views: 257
Reputation: 33068
I believe Entrust sets up the user/roles relationships for you so you'd just do the same thing you would normally do without Entrust.
$customers = User::whereHas('roles', function($query)
{
$query->where('name', 'customer');
})->get();
Upvotes: 1