Support the ongoing development of Laravel.io →
posted 9 years ago
Eloquent
Last updated 2 years ago.
0

It doesn't seem like there are any "easy" way to do this with Entrust. Maybe something like this?

$permission_id = 1;

$users = User::whereHas('roles', function($query) use ($permission_id) {

	$query->whereHas('perms', function($query) use ($permission_id) {

		$query->where('id', '=', $permission_id);

	});

})->get();
0

thomastkim said:

It doesn't seem like there are any "easy" way to do this with Entrust. Maybe something like this?

$permission_id = 1;

$users = User::whereHas('roles', function($query) use ($permission_id) {

  $query->whereHas('perms', function($query) use ($permission_id) {

  	$query->where('id', '=', $permission_id);

  });

})->get();

Thank you very much!

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.