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); } }