entrust icon indicating copy to clipboard operation
entrust copied to clipboard

find all users that can('some_permisssion') and send notification

Open hamidhaghdoost opened this issue 9 years ago • 3 comments

Hi, I want to get all users that has some permission and send them a notification... how to get them? Thanks

hamidhaghdoost avatar Dec 20 '16 22:12 hamidhaghdoost

Is not there anyone to me question?

hamidhaghdoost avatar Dec 29 '16 09:12 hamidhaghdoost

$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..

tianyong90 avatar Dec 29 '16 10:12 tianyong90

Thanks, but I changed my code to my own role_permission style without entrust :+1:

Thanks again @tianyong90

hamidhaghdoost avatar Dec 29 '16 12:12 hamidhaghdoost