A free open source IT asset/license management system
Fixed #9680: Use Eloquent’s `withCount` method to count Statuslabel assets
Travis Miller4f6b1bb12da5
diff --git a/app/Http/Controllers/Api/StatuslabelsController.php b/app/Http/Controllers/Api/StatuslabelsController.phpindex 567159c58f..0e5b6cb536 100644--- a/app/Http/Controllers/Api/StatuslabelsController.php+++ b/app/Http/Controllers/Api/StatuslabelsController.php@@ -167,10 +167,7 @@ class StatuslabelsController extends Controller{$this->authorize('view', Statuslabel::class);- $statuslabels = Statuslabel::with('assets')- ->groupBy('id')- ->withCount('assets as assets_count')- ->get();+ $statuslabels = Statuslabel::withCount('assets')->get();$labels=[];$points=[];