Skip to content

Commit

Permalink
Fixed snipe#9680: Use Eloquent’s withCount method to count Statusla…
Browse files Browse the repository at this point in the history
…bel assets
  • Loading branch information
travismiller committed Jun 9, 2021
1 parent 0a2ab79 commit 41225fb
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions app/Http/Controllers/Api/StatuslabelsController.php
Expand Up @@ -167,10 +167,7 @@ public function getAssetCountByStatuslabel()
{
$this->authorize('view', Statuslabel::class);

$statuslabels = Statuslabel::with('assets')
->groupBy('id')
->withCount('assets as assets_count')
->get();
$statuslabels = Statuslabel::withCount('assets')->get();

$labels=[];
$points=[];
Expand Down

0 comments on commit 41225fb

Please sign in to comment.