Skip to content

Commit f461857

Browse files
author
Nur Alam
committed
custom permission bug fixed
1 parent f35ed88 commit f461857

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/Permissions.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,20 +81,20 @@ protected function customPermissions(): Permissions
8181

8282
if (is_array($customPermissions) && !empty($customPermissions)) {
8383
foreach ($customPermissions as $key => $permission) {
84-
// when the permission only contains permission name
85-
if (array_key_exists(0, $permission) && is_array($permission)) {
86-
foreach ($permission as $item) {
84+
foreach ($permission as $item) {
85+
// when the permission only contains permission name
86+
if (!is_array($item)) {
8787
$this->permissions[$key][] = [
8888
'name' => $item,
8989
'title' => ucwords(str_replace($this->splitter, ' ', $item)),
9090
];
91+
92+
continue;
9193
}
9294

93-
continue;
95+
// when permission has valid permission structure (ex: slug, name key available)
96+
$this->permissions[$key][] = $item;
9497
}
95-
96-
// when permission has valid permission structure (ex: slug, name key available)
97-
$this->permissions[$key][] = $permission;
9898
}
9999
}
100100

0 commit comments

Comments
 (0)