In default the ordering of left menu items is in alphabetical order.
My client wants to order those menus manually. Any idea how to make it possible?
Go to answer
Advertisement
Answer
There are two ways to achieve this:
- By setting priority to Resource
- Ordering Resource models in NovaServiceProvider
1. Priority Method
- Add priority as in the following code in Resource model:
public static $priority = 2;
- Then update NovaServiceProvider like this:
public function boot() { Nova::sortResourcesBy(function ($resource) { return $resource::$priority ?? 9999; }); }
2. Ordering Resource models in NovaServiceProvider
In NovaServiceProvider, order Resource models like this:
protected function resources() { Nova::resources([ User::class, Post::class, ]); }