Skip to content

Commit 1462442

Browse files
committed
Remove unused parameter
1 parent 99f3906 commit 1462442

File tree

1 file changed

+16
-19
lines changed

1 file changed

+16
-19
lines changed

src/Jobs/RecordMetric.php

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use DirectoryTree\Metrics\Metric;
88
use Illuminate\Bus\Queueable;
99
use Illuminate\Contracts\Queue\ShouldQueue;
10-
use Illuminate\Database\ConnectionInterface;
1110
use Illuminate\Foundation\Bus\Dispatchable;
1211
use Illuminate\Support\Collection;
1312

@@ -42,23 +41,21 @@ public function handle(): void
4241
/** @var \Illuminate\Database\Eloquent\Model $model */
4342
$model = new DatabaseMetricManager::$model;
4443

45-
$model->getConnection()->transaction(
46-
function (ConnectionInterface $connection) use ($metric, $value, $model) {
47-
$instance = $model->newQuery()->firstOrCreate([
48-
...$metric->additional(),
49-
'name' => $metric->name(),
50-
'category' => $metric->category(),
51-
'year' => $metric->year(),
52-
'month' => $metric->month(),
53-
'day' => $metric->day(),
54-
'measurable_type' => $metric->measurable()?->getMorphClass(),
55-
'measurable_id' => $metric->measurable()?->getKey(),
56-
], ['value' => 0]);
57-
58-
$model->newQuery()
59-
->whereKey($instance)
60-
->increment('value', $value);
61-
}
62-
);
44+
$model->getConnection()->transaction(function () use ($metric, $value, $model) {
45+
$instance = $model->newQuery()->firstOrCreate([
46+
...$metric->additional(),
47+
'name' => $metric->name(),
48+
'category' => $metric->category(),
49+
'year' => $metric->year(),
50+
'month' => $metric->month(),
51+
'day' => $metric->day(),
52+
'measurable_type' => $metric->measurable()?->getMorphClass(),
53+
'measurable_id' => $metric->measurable()?->getKey(),
54+
], ['value' => 0]);
55+
56+
$model->newQuery()
57+
->whereKey($instance)
58+
->increment('value', $value);
59+
});
6360
}
6461
}

0 commit comments

Comments
 (0)