This commit is contained in:
2024-09-01 18:54:23 +05:00
parent 76d18365a5
commit 061f09eca1
1597 changed files with 109451 additions and 1 deletions

View File

@@ -0,0 +1,34 @@
<?php
namespace Laravel\Nova\Http\Requests;
use Laravel\Nova\Metrics\Metric;
use Laravel\Nova\Nova;
/**
* @property-read string $metric
*/
class DashboardMetricRequest extends NovaRequest
{
/**
* Get the metric instance for the given request.
*
* @return \Laravel\Nova\Metrics\Metric
*/
public function metric()
{
return $this->availableMetrics()->first(function ($metric) {
return $this->metric === $metric->uriKey();
}) ?: abort(404);
}
/**
* Get all of the possible metrics for the request.
*
* @return \Illuminate\Support\Collection
*/
public function availableMetrics()
{
return Nova::allAvailableDashboardCards($this)->whereInstanceOf(Metric::class);
}
}