You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+15-15Lines changed: 15 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -55,68 +55,68 @@ You can define metric links using the `route` method from the `Linkable` trait i
55
55
**Index Route**
56
56
57
57
```php
58
-
// NovaServiceProvider.php
58
+
// App\Nova\Dashboards\Main.php
59
59
60
60
/**
61
-
* Get the cards that should be displayed on the Nova dashboard.
61
+
* Get the cards for the dashboard.
62
62
*
63
63
* @return array
64
64
*/
65
65
protected function cards()
66
66
{
67
67
return [
68
-
(new JobsInProgress)->width('1/3')->route('index', ['resourceName' => 'jobs']),
68
+
(new TotalUsers)->width('1/3')->route('nova.pages.index', ['resource' => 'users']),
69
69
];
70
70
}
71
71
```
72
72
73
73
**OR using a Lens Route**
74
74
75
75
```php
76
-
// NovaServiceProvider.php
76
+
// App\Nova\Dashboards\Main.php
77
77
78
78
/**
79
-
* Get the cards that should be displayed on the Nova dashboard.
79
+
* Get the cards for the dashboard.
80
80
*
81
81
* @return array
82
82
*/
83
83
protected function cards()
84
84
{
85
85
return [
86
-
(new JobsInProgress)->width('1/3')->route('lens', ['resourceName' => 'jobs', 'lens' => 'all-jobs']),
86
+
(new TotalUsers)->width('1/3')->route('nova.pages.lens', ['resource' => 'users', 'lens' => 'active-users']),
87
87
];
88
88
}
89
89
```
90
90
91
91
**OR using a Filter Route**
92
92
93
93
```php
94
-
// NovaServiceProvider.php
94
+
// App\Nova\Dashboards\Main.php
95
95
96
96
/**
97
-
* Get the cards that should be displayed on the Nova dashboard.
97
+
* Get the cards for the dashboard.
98
98
*
99
99
* @return array
100
100
*/
101
101
protected function cards()
102
102
{
103
-
$filters = base64_encode(json_encode([
103
+
$filter = base64_encode(json_encode([
104
104
[
105
-
'class' => JobStatus::class,
105
+
'class' => UserStatus::class,
106
106
'value' => 'active',
107
107
],
108
108
]));
109
109
110
110
return [
111
-
(new JobsInProgress)->width('1/3')->route('lens', ['resourceName' => 'jobs'], ['jobs_filter' => $filters]),
111
+
(new JobsInProgress)->width('1/3')->route('nova.pages.index', ['resource' => 'users', 'users_filter' => $filter]),
112
112
];
113
113
}
114
114
```
115
115
116
116
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):
117
117
118
118
```php
119
-
// In your linktable Nova metric class
119
+
// In your linkable Nova metric class
120
120
121
121
/**
122
122
* Calculate the value of the metric.
@@ -127,14 +127,14 @@ You can define metric links using the `route` method from the `Linkable` trait i
127
127
public function calculate(Request $request, UnitOfMeasure $unitOfMeasure)
0 commit comments