normanhuth/nova-menu-order

Sort the resources and resources groups in the Nova menu


Keywords
menu, order, nova, sort, laravel, resource
License
MIT

Documentation

Sort the Nova resources and resource groups in the menu.

Install:
composer require normanhuth/nova-menu-order

Now publish the config file:
php artisan vendor:publish --provider="NormanHuth\NovaMenuOrder\NovaMenuOrderServiceProvider" --tag=config

After publish this, You find the file config/nova-group-order.php, where You can sort the resources groups:

 return [
     'Other'     => 10,
     'Archives'  => 20,
 ];

If the file resources/views/vendor/nova/resources/navigation.blade.php not exists, You can publish this file:
php artisan vendor:publish --provider="NormanHuth\NovaMenuOrder\NovaMenuOrderServiceProvider" --tag=view

If this file already exist, You have 2 Options.
Option 1:
Overwrite the file with:
php artisan vendor:publish --provider="NormanHuth\NovaMenuOrder\NovaMenuOrderServiceProvider" --tag=view --force

Option 2:
Edit the file and change {{ $group }} to {!! $group !!} and {{ $resource::label() }} to {!! $resource::label() !!}


Use this package in the Nova resources:

use NormanHuth\NovaMenuOrder\Nova\CustomResource;

class Contact extends CustomResource

And to order the resources:

use NormanHuth\NovaMenuOrder\Nova\CustomResource;

class Contact extends CustomResource
{
    public static $order = 20;

Localize Labels - use alternative method

    public static function setLabel()
    {
        return __('Contact');
    }
    public static function setSingularLabel()
    {
        return __('Contact');
    }

If You use klepak/nova-dynamic-page-title, You find in the folder nova-dynamic-page-title a custom JS-asset to override, change, edit this package.