diff --git a/src/Menu.php b/src/Menu.php index f7d8882..e283efe 100644 --- a/src/Menu.php +++ b/src/Menu.php @@ -58,8 +58,24 @@ public function all() protected function filterByVisibility(Item $item) { + $permission = $item->data('permission'); + // If menu doesn't define permission, we assume this menu visible to everyone // Otherwise, check if current user has access - return $item->data('permission') === null || auth()->user()->can($item->data('permission')); + if ($permission === null) { + return true; + } + + // If it was multiple permissions, we check using OR conditions. + // It means, user only need to have one of the permissions + if (is_array($permission)) { + foreach ($permission as $perm) { + if (auth()->user()->can($perm)) { + return true; + } + } + } + + return auth()->user()->can($item->data('permission')); } }