Eager load adminuser

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2024-09-19 19:56:39 +01:00
parent eb6f05faf7
commit f283b5fbe8

View file

@ -52,7 +52,9 @@ class CategoriesController extends Controller
'require_acceptance', 'require_acceptance',
'checkin_email', 'checkin_email',
'image', 'image',
])->withCount('accessories as accessories_count', 'consumables as consumables_count', 'components as components_count', 'licenses as licenses_count'); ])
->with('adminuser')
->withCount('accessories as accessories_count', 'consumables as consumables_count', 'components as components_count', 'licenses as licenses_count');
/* /*
@ -109,7 +111,7 @@ class CategoriesController extends Controller
$limit = app('api_limit_value'); $limit = app('api_limit_value');
$order = $request->input('order') === 'asc' ? 'asc' : 'desc'; $order = $request->input('order') === 'asc' ? 'asc' : 'desc';
$sort_override = $request->input('sort'); $sort_override = $request->input('sort');
$column_sort = in_array($sort_override, $allowed_columns) ? $sort_override : 'created_at'; $column_sort = in_array($sort_override, $allowed_columns) ? $sort_override : 'assets_count';
switch ($sort_override) { switch ($sort_override) {
case 'created_by': case 'created_by':