Created
January 27, 2023 11:47
-
-
Save dmason30/18b8e502e536ba533f5e2c64fb502497 to your computer and use it in GitHub Desktop.
Collapse Nova 4.20+ Menu By Default
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Nova::mainMenu(function (Request $request, Menu $menu) { | |
$menu->items->each(function ($m) { | |
if ($m instanceof MenuSection && $m->items->isNotEmpty()) { | |
$m->collapsedByDefault(); | |
$m->items->each(function ($m) { | |
if ($m instanceof MenuGroup && $m->items->isNotEmpty()) { | |
$m->collapsedByDefault(); | |
} | |
}); | |
} | |
}); | |
return $menu; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment