Skip to content

Commit f019e14

Browse files
Ionys320jbrooksuk
andcommitted
feat(metrics): Simplify a bit the code of metric points transformation
Co-authored-by: James Brooks <[email protected]>
1 parent 1f51e3b commit f019e14

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/View/Components/Metrics.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,10 @@ public function render(): View
2525

2626
// Convert each metric point to Chart.js format (x, y)
2727
$metrics->each(function ($metric) {
28-
$metric->metricPoints->transform(function ($point) {
29-
return [
30-
'x' => $point->created_at->toIso8601String(),
31-
'y' => $point->value,
32-
];
33-
});
28+
$metric->metricPoints->transform(fn ($point) => [
29+
'x' => $point->created_at->toIso8601String(),
30+
'y' => $point->value,
31+
]);
3432
});
3533

3634
return view('cachet::components.metrics', [

0 commit comments

Comments
 (0)