diff --git a/src/Traits/HasPermissions.php b/src/Traits/HasPermissions.php index 573ac4ae3..bf0672dc7 100644 --- a/src/Traits/HasPermissions.php +++ b/src/Traits/HasPermissions.php @@ -21,11 +21,14 @@ public function allPermissions(): Collection return $this->allPermissions; } + $permissionsModel = config('admin.database.permissions_model'); + $primaryKey = (new $permissionsModel)->getKeyName(); + return $this->allPermissions = $this->roles ->pluck('permissions') ->flatten() - ->keyBy($this->getKeyName()); + ->keyBy($primaryKey); } /**