From f283b5fbe88b3f582b8f13c52532bb8de80548da Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 19 Sep 2024 19:56:39 +0100 Subject: [PATCH] Eager load adminuser Signed-off-by: snipe --- app/Http/Controllers/Api/CategoriesController.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Api/CategoriesController.php b/app/Http/Controllers/Api/CategoriesController.php index 8a7603d05a..e772bec4df 100644 --- a/app/Http/Controllers/Api/CategoriesController.php +++ b/app/Http/Controllers/Api/CategoriesController.php @@ -52,7 +52,9 @@ class CategoriesController extends Controller 'require_acceptance', 'checkin_email', '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'); $order = $request->input('order') === 'asc' ? 'asc' : 'desc'; $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) { case 'created_by':