normanhuth/nova-menu-order

This package is abandoned and no longer maintained. No replacement package was suggested.

Sort the resources and resources groups in the Nova menu

1.0.8 2020-10-11 10:07 UTC

This package is not auto-updated.

Last update: 2020-10-25 10:17:29 UTC


README

New alternative Method: https://gist.github.com/jbrooksuk/c7c1ab6ea094a29d7dbb1fbdb17d05e1

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.