Show a NavigationItem to admins only

I use a closure to ensure some navigation items are visible to admins only:

NavigationItem::make('Admin')
                    ->visible(fn() => auth()->user()->hasRole('super-admin'))
                    ->url('/admin')
                    ->icon('gmdi-settings-o'),


Unfortunately this makes it impossible to use
php artisan route:cache
. What would be a better way of doing this?
Was this page helpful?