1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-31 15:24:31 +03:00

Added interface for adding/removing roles in entity perms.

This commit is contained in:
Dan Brown
2022-10-10 12:24:23 +01:00
parent ffd6a1002e
commit 803934d020
7 changed files with 177 additions and 25 deletions

View File

@ -15,16 +15,15 @@ class PermissionFormData
}
/**
* Get the roles with permissions assigned.
* Get the permissions with assigned roles.
*/
public function rolesWithPermissions(): array
public function permissionsWithRoles(): array
{
return $this->entity->permissions()
->with('role')
->where('role_id', '!=', 0)
->get(['id', 'role_id'])
->pluck('role')
->sortBy('display_name')
->get()
->sortBy('role.display_name')
->all();
}