This package is for Nova 4.
This package brings back the policy authorization for MenuItemInclude since Nova 4.2.5Also, the well-known canSee method is added to MenuItem and MenuSectionInclude since Nova 4.2.5Empty menu sections are automatically hiddenInclude since Nova 4.6.0- Heroicon & Font Awesome Icon for MenuSection, MenuItem & MenuGroup
composer require norman-huth/nova-menu
- Use
NormanHuth\NovaMenu\MenuSection
instead ofLaravel\Nova\Menu\MenuSection
- Use
NormanHuth\NovaMenu\MenuItem
instead ofLaravel\Nova\Menu\MenuItem
- Use
NormanHuth\NovaMenu\MenuGroup
instead ofLaravel\Nova\Menu\MenuGroup
Use the faIcon
method:
use NormanHuth\NovaMenu\MenuSection; // <!- Use this
class NovaServiceProvider extends NovaApplicationServiceProvider
{
public function boot()
{
parent::boot();
Nova::mainMenu(function (Request $request) {
return [
MenuSection::make(__('Customers'), [
// Menu Items
])->collapsable()
->faIcon('fa-brands fa-laravel')
];
});
}
Use the icon
method
use NormanHuth\NovaMenu\MenuGroup; // <!- Use this
class NovaServiceProvider extends NovaApplicationServiceProvider
{
public function boot()
{
parent::boot();
Nova::mainMenu(function (Request $request) {
return [
MenuGroup::make(__('Customers'), [
// Menu Items
])->icon('chart-bar')
];
});
}
Use the faIcon
method
use NormanHuth\NovaMenu\MenuGroup; // <!- Use this
class NovaServiceProvider extends NovaApplicationServiceProvider
{
public function boot()
{
parent::boot();
Nova::mainMenu(function (Request $request) {
return [
MenuGroup::make(__('Customers'), [
// Menu Items
])->faIcon('fa-brands fa-laravel')
];
});
}
Use the icon
method
use NormanHuth\NovaMenu\MenuItem; // <!- Use this
class NovaServiceProvider extends NovaApplicationServiceProvider
{
public function boot()
{
//--
MenuItem::resource(User::class)->icon('chart-bar'),
//--
}
Use the faIcon
method
use NormanHuth\NovaMenu\MenuItem; // <!- Use this
class NovaServiceProvider extends NovaApplicationServiceProvider
{
public function boot()
{
//--
MenuItem::resource(User::class)->faIcon('fa-brands fa-laravel'),
//--
}
Use the asLabel
method
use NormanHuth\NovaMenu\MenuItem; // <!- Use this
use NormanHuth\NovaMenu\MenuGroup; // <!- Use this
class NovaServiceProvider extends NovaApplicationServiceProvider
{
public function boot()
{
//--
MenuItem::resource(User::class)->icon('chart-bar')->asLabel(),
MenuItem::resource(User::class)->faIcon('fa-brands fa-laravel')->asLabel(),
//--
MenuGroup::make('Twitch', [
//--
])->faIcon('fa-brands fa-twitch')->asLabel(),
//--
}
This package doesn't include Font Awesome. The font must still be added manually.
How you do that is up to you. Here is one way:
- Add Your Font Awesome JS oder CSS in
resources/vendor/nova/views/partials/meta.blade.php