Skip to content

Commit

Permalink
Fix permission:show uuid error #2581 (#2582)
Browse files Browse the repository at this point in the history
Use `getKeyName()` instead of `'id'`

Fixes #2581
  • Loading branch information
drbyte committed Apr 19, 2024
1 parent 2c5369e commit 96c2761
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Commands/Show.php
Expand Up @@ -40,12 +40,12 @@ public function handle()
->when($teamsEnabled, fn ($q) => $q->orderBy($team_key))
->orderBy('name')->get()->mapWithKeys(fn ($role) => [
$role->name.'_'.($teamsEnabled ? ($role->$team_key ?: '') : '') => [
'permissions' => $role->permissions->pluck('id'),
'permissions' => $role->permissions->pluck($permissionClass->getKeyName()),
$team_key => $teamsEnabled ? $role->$team_key : null,
],
]);

$permissions = $permissionClass::whereGuardName($guard)->orderBy('name')->pluck('name', 'id');
$permissions = $permissionClass::whereGuardName($guard)->orderBy('name')->pluck('name', $permissionClass->getKeyName());

$body = $permissions->map(fn ($permission, $id) => $roles->map(
fn (array $role_data) => $role_data['permissions']->contains($id) ? ' ✔' : ' ·'
Expand Down

0 comments on commit 96c2761

Please sign in to comment.