I have a database table of branch_user_permission that has 3 table columns of [branch_id, permission_id, user_id]
Here is the sample data of the database
Sample Data of Branch Permission User
I just want to map or get all users where all permissions (permission_id) are the same with other branches (branch_id)
Example:
[branch_id][permission_id][user_id]
[1][2][1]
[1][3][1]
[1][5][1]
[1][6][1]
[2][2][2]
[2][3][2]
[2][5][2]
[2][6][2]
[3][2][3]
[3][3][3]
[3][6][3]
[4][2][5]
[4][3][5]
[4][5][5]
[4][6][5]
So the expected output that I will get for getting all user_ids where all permission are the same from all other branches:
- Array (1,2,5)
[[1,2,5], [3]]- shudder