Closed salmanhijazi closed 5 months ago
Please take a moment https://github.com/serenysoft/nova-permissions/issues/38#issuecomment-1964653109
That issue is marked as closed, does that mean it is already merged? Because, I have the latest version and it doesn't work.
Here's my code to make it work:
public function disablePermissions()
{
$this->displayPermissions = false;
$this->permissionResource::$displayInNavigation = false;
return $this;
}
public function disableMenu()
{
$this->menuDisabled = true;
$this->roleResource::$displayInNavigation = $this->menuDisabled;
$this->permissionResource::$displayInNavigation = !$this->displayPermissions ? $this->displayPermissions : $this->menuDisabled;
return $this;
}
public function menu(Request $request)
{
if ($this->menuDisabled) {
return [];
}
return MenuSection::make(__('Roles'. ($this->displayPermissions ? ' & Permissions' : '')), [
$this->createMenuItem($this->roleResource),
$this->displayPermissions ? $this->createMenuItem($this->permissionResource) : ''
])->icon('shield-check')->collapsable();
}
Please make a PR
ref 4a30855e57ada9e058602451d8c191cfd711df31
Hello,
I want to hide the permissions resource, but it is not working. I have tried with and without disableMenu().
Updating the disablePermissions function works if I update it to this:
Although, the naming of this function is misleading, probably worth renaming it to "hidePermissionsFromSidebar"
Thank you!