Merge pull request #14216 from snipe/bug/sc-24727

Fixed company asset counts for dashboard widget
This commit is contained in:
snipe 2024-02-05 16:07:40 +00:00 committed by GitHub
commit abd13a1140
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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'));