diff --git a/README.md b/README.md index 6fa9237..581c0dd 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,8 @@ There is now a `php artisan nova:dashboard ` command exposed via the CLI. If you run this, you'll get a `App/Nova/Dashboards` directory created, which will house your custom dashboards. +Dashboards have a `public $order` variable you can use to set the order they appear in the navbar. See the `Dashboard` class for more. + If you are another package creating a nova dashboard, you will need to register it using: ```php diff --git a/src/Dashboard.php b/src/Dashboard.php index 9a664f4..ee84b78 100644 --- a/src/Dashboard.php +++ b/src/Dashboard.php @@ -6,5 +6,5 @@ abstract class Dashboard extends Element { - // + public $sort; } diff --git a/src/DashboardNova.php b/src/DashboardNova.php index a020ebb..f3011aa 100644 --- a/src/DashboardNova.php +++ b/src/DashboardNova.php @@ -78,13 +78,13 @@ public static function dashboardsIn($directory) } static::dashboards( - collect($dashboards)->sort()->transform(function ($dashboard) { + collect($dashboards)->transform(function ($dashboard) { if ($dashboard instanceof Dashboard) { return $dashboard; } return app()->make($dashboard); - })->all() + })->sortBy('label')->sortBy('order')->all() ); }