Fix company asset counts for dashboard widget

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2024-02-05 15:55:53 +00:00
parent dc92bbf61e
commit 5882d71f9b

View file

@ -40,7 +40,9 @@ class CompaniesController extends Controller
'components_count',
];
$companies = Company::withCount('assets as assets_count', 'licenses as licenses_count', 'accessories as accessories_count', 'consumables as consumables_count', 'components as components_count', 'users as users_count');
$companies = Company::withCount(['assets as assets_count' => function ($query) {
$query->AssetsForShow();
}])->withCount('licenses as licenses_count', 'accessories as accessories_count', 'consumables as consumables_count', 'components as components_count', 'users as users_count');
if ($request->filled('search')) {
$companies->TextSearch($request->input('search'));