Skip to content
This repository has been archived by the owner on Sep 5, 2019. It is now read-only.

Commit

Permalink
Merge pull request #4 from jrmadsen67/master
Browse files Browse the repository at this point in the history
allow ordering of dashboards
  • Loading branch information
alexbowers authored Dec 17, 2018
2 parents e824cf6 + 9bd8619 commit 1ead826
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ There is now a `php artisan nova:dashboard <name>` 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
Expand Down
2 changes: 1 addition & 1 deletion src/Dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@

abstract class Dashboard extends Element
{
//
public $sort;
}
4 changes: 2 additions & 2 deletions src/DashboardNova.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
);
}

Expand Down

0 comments on commit 1ead826

Please sign in to comment.