Skip to content

Commit

Permalink
Update AdminSidebar.php
Browse files Browse the repository at this point in the history
  • Loading branch information
ndeblauw authored May 31, 2024
1 parent 1480a59 commit da45323
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/View/Components/Adminlayout/AdminSidebar.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ private function annotateActive($menu, $uri)
$value = str_replace('/for-season', '', $value);

foreach ($menu as &$item) {
$item['hidden'] = false;
if(isset($item['color'])) {
$item['bg_color'] = "bg-{$item['color']}-50";
$item['icon_color_active'] = "text-{$item['color']}-200";
Expand All @@ -46,6 +47,12 @@ private function annotateActive($menu, $uri)

foreach ($menu as &$item) {
$open = false;

if(isset($item['permission'])) {
if(!auth()->user()->hasPermissionTo($item['permission'])) {
$item['hidden'] = true;
}
}

if(isset($item['header'])) {
continue;
Expand All @@ -62,7 +69,7 @@ private function annotateActive($menu, $uri)
} else {
if ($item['link'] == $value) {
$item['active'] = true;
break;
continue;
}
}

Expand Down

0 comments on commit da45323

Please sign in to comment.