Skip to content

Commit

Permalink
Add lens route example.
Browse files Browse the repository at this point in the history
  • Loading branch information
anderly authored May 6, 2019
1 parent ab79db0 commit 3264bba
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ use LinkablePartition;
You can define metric links using the `route` method from the `Linkable` trait in one of two ways:

1. When the card is registered:

**Index Route**

```php
// NovaServiceProvider.php

Expand All @@ -62,10 +65,29 @@ You can define metric links using the `route` method from the `Linkable` trait i
protected function cards()
{
return [
(new JobsInProgress)->width('1/3')->route('index', ['resourceName' => 'jobs']),`
(new JobsInProgress)->width('1/3')->route('index', ['resourceName' => 'jobs']),
];
}
```

**OR using a Lens Route**

```php
// NovaServiceProvider.php

/**
* Get the cards that should be displayed on the Nova dashboard.
*
* @return array
*/
protected function cards()
{
return [
(new JobsInProgress)->width('1/3')->route('lens', ['resourceName' => 'jobs', 'lens' => 'all-jobs']),
];
}
```

2. Or, within the card itself (useful for cards only available on detail screens where you might want to filter the url based on the current resource):

```php
Expand Down

0 comments on commit 3264bba

Please sign in to comment.