hasRole etc not taking into account the team_id #2136
-
So I am rendering a list of Roles and want to toggle which roles are set on the current team. So a simple loop thourgh with: setPermissionsTeamId($theTeamId); If the user has my_role assigned to anytime hasRole returns true... so somewhere setPermissionsTeamId isn't being taken into account. Can someone point me in the right direction? Noting that setting the permissionsTeamID and assignRole / removeRole all works fine and are stored in the DB. I have 3 Records in the model_has_roles table, two one 1 team and 1 on another. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Maybe you preload the roles relation before Try this $user->unsetRelation('roles');
setPermissionsTeamId($theTeamId);
$hasRole = $user->hasRole('my_role'); |
Beta Was this translation helpful? Give feedback.
Maybe you preload the roles relation before
setPermissionsTeamId
Try this