entrust
entrust copied to clipboard
find all users that can('some_permisssion') and send notification
Hi, I want to get all users that has some permission and send them a notification... how to get them? Thanks
Is not there anyone to me question?
$users = \App\User::whereHas('roles', function ($roleQuery) {
$roleQuery->whereHas('perms', function ($permissionQuery) {
$permissionQuery->where('name', 'the_permissionname'); // or other condigions...
});
})->get();
@tuytoosh Try this way..
Thanks, but I changed my code to my own role_permission style without entrust :+1:
Thanks again @tianyong90