-1
I have 3 tables, Users
, Roles
and Permissions
Example:
User
Carlos has 1 Role
Admin
and 1 Role
Admin
has 2 Permissions
admin
and user
count(Auth::user()
->roles()
->with('permissions')
->whereHas('permissions', function ($q) {
$q->where('name', 'superadmin');
})
->get()) > 0
here the right query but, if you are going to list all I wanted to hide only who has the permission
admin
$user = new User();
$users = $user
->roles()
->with('permissions')
->whereDoesntHave('permissions', function ($q) {
$q->where('name', 'admin');
})
->get();
Any answers solved your problem? if you can’t add to your questions the entities that compose this filter
– novic