From fd9b1ffd5a501c3a580fcac80011a191f5ce72e0 Mon Sep 17 00:00:00 2001 From: James Brooks Date: Fri, 25 Nov 2016 20:07:49 +0000 Subject: [PATCH] Slight refactor --- .../Handlers/Commands/Metric/AddMetricPointCommandHandler.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/Bus/Handlers/Commands/Metric/AddMetricPointCommandHandler.php b/app/Bus/Handlers/Commands/Metric/AddMetricPointCommandHandler.php index 91a07f495..ce34b1493 100644 --- a/app/Bus/Handlers/Commands/Metric/AddMetricPointCommandHandler.php +++ b/app/Bus/Handlers/Commands/Metric/AddMetricPointCommandHandler.php @@ -70,9 +70,8 @@ class AddMetricPointCommandHandler protected function findOrCreatePoint(AddMetricPointCommand $command) { $buffer = Carbon::now()->subMinutes($command->metric->threshold); - $point = MetricPoint::where('metric_id', '=', $command->metric->id)->where('value', '=', $command->value)->where('created_at', '>=', $buffer)->first(); - if ($point) { + if ($point = MetricPoint::where('metric_id', '=', $command->metric->id)->where('value', '=', $command->value)->where('created_at', '>=', $buffer)->first()) { return $point; }