norman-huth/nova-hide-navigation
A Laravel Nova package for hiding navigation items from the sidebar, helping keep the admin panel clean and focused. Useful when you want certain resources, tools, or menu entries left out of Nova's navigation without removing them entirely.
This package is archived (last release 2023-11-04, 2 stars, 0 dependents), so treat it as unmaintained code you are adopting rather than a dependency you are consuming. Before writing anything, read the README's maintained-alternatives note and decide whether you are forking, vendoring, or migrating.
Minimal path:
composer.json rather than relying on a floating constraint, since no further patches will arrive.composer require norman-huth/nova-hide-navigation and let package auto-discovery register the service provider. If discovery is not used, add the provider to config/app.php or your Nova application bootstrap.vendor:publish with the package provider, then php artisan nova:publish) and inspect the published config/assets — that is where the actual toggle lives.Where to look first: the published config file, the package's service provider, and any published assets/views. Those three tell you whether hiding is config-driven, middleware-driven, or CSS/asset-driven — and that determines the integration pattern below.
Wrap it behind your own adapter. Because the package is archived, do not call its API from controllers, policies, or Blade views directly. Put a single class (e.g. App\Nova\NavigationVisibility) that reads your config/env and delegates to the package. When you migrate to a maintained alternative, only the adapter changes.
Config-driven, not hard-coded. Keep the enable/disable logic in a config file keyed by guard, role, or environment. This gives you a one-line kill switch in staging and local without touching code:
// config/nova-navigation.php
'hide' => env('NOVA_HIDE_NAV', false),
'except_roles' => ['admin'],
Per-request scoping. If the package toggles behaviour during Nova boot, prefer request-time callbacks (Nova::serving(...), Nova::available(...), or a small middleware) over boot-time Auth::user() checks. Nova boots before the authenticated user is reliably resolved in some flows — the toggle will silently no-op if you check too early.
Tool vs. card registration. If the package registers a Nova Tool, it goes in NovaServiceProvider::tools(); if it's a card, cards(). Register it conditionally so it doesn't appear in production menus you are trying to hide.
Pair hiding with authorization. Hiding navigation is cosmetic. For each resource you hide, also set authorizedToViewAny / policies so the endpoint is unreachable. Day-to-day this means your PR checklist has two items: "hidden from nav" and "blocked by policy".
Asset-layer integration. If the hide is implemented as a body class or injected CSS, publish the assets and target them from your own resources/css/nova.css. Compile once and let nova:publish copy it. Keep custom CSS separate so a future package swap does not lose your styling.
Testing. Add a plain HTTP test hitting /nova as each role and assert on the presence/absence of the nav markup (or the package's injected class). A feature test here catches almost every regression this package can cause.
Migration path. Document the adapter's contract in a docblock. The realistic alternative is either a maintained Nova package from the README or Nova's own menu customization (Nova::mainMenu(), Nova::userMenu() in Nova 4+), which removes the dependency entirely for most hide-nav use cases.
"repositories": [{"type": "path", "url": "packages/nova-hide-navigation"}] so you can patch Nova-compatibility issues without waiting on a release that will never come.config:cache, route:cache, and Nova's compiled assets all freeze the toggle. After any change run php artisan config:clear && php artisan nova:publish and hard-refresh the browser.public/vendor/... bundle. Check the network tab for the old asset hash before debugging PHP.Auth::user() during Nova boot can be too early — move the check into a serving/available callback or middleware.app()->isProduction() sanity checks and log when the hidden mode is active.dd() inside the service provider to confirm registration; check storage/logs/laravel.log for provider resolution errors.composer.lock.How can I help you explore Laravel packages today?