Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

andreas_'s avatar

Custom order of Resource Groups

Is there any way to set a custom order for navigation groups without using a custom navigation_blade.php?

Laravel\Nova\Nova:: groupedResources

    /**
     * Get the grouped resources available for the given request.
     *
     * @param  Request $request
     * @return array
     */
    public static function groupedResources(Request $request)
    {
        return collect(static::availableResources($request))
                    ->groupBy(function ($item, $key) {
                        return $item::group();
                    })->sortKeys()->all();
    }
0 likes
3 replies
devfrey's avatar

Unfortunately no, you'll have to overwrite that method.

yaroslawww's avatar

You can add callback

class NovaServiceProvider extends NovaApplicationServiceProvider
{
   
    public function boot()
    {
        Nova::sortResourcesBy(function ($resource) {
            return $resource::$navSidebarOrder ?? $resource::label();
        });
        parent::boot();
    }

So now you can add static property $navSidebarOrder to resource and it will order by this property

2 likes
drsdre's avatar

This callback only works for the resources within a group. It does not allow the groups itself to be sorted. Unfortunately it looks like the alfabetical sorting is hardcoded in Nova (still).

I've tried doing a pull request for this, but it needs more work. See https://github.com/laravel/nova/pull/843

Please or to participate in this conversation.