From cce8cb4f5ef5c105d6141463a78617fb93cbe764 Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 14 Mar 2024 13:24:22 +0000 Subject: [PATCH] Move requestable scope below sorting, etc Signed-off-by: snipe --- app/Http/Controllers/Api/AssetsController.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/Api/AssetsController.php b/app/Http/Controllers/Api/AssetsController.php index d9e9a2190f..b26887b6ce 100644 --- a/app/Http/Controllers/Api/AssetsController.php +++ b/app/Http/Controllers/Api/AssetsController.php @@ -1062,8 +1062,7 @@ class AssetsController extends Controller $assets = Asset::select('assets.*') ->with('location', 'assetstatus', 'assetlog', 'company','assignedTo', - 'model.category', 'model.manufacturer', 'model.fieldset', 'supplier', 'requests') - ->requestableAssets(); + 'model.category', 'model.manufacturer', 'model.fieldset', 'supplier', 'requests'); @@ -1071,7 +1070,7 @@ class AssetsController extends Controller if ($request->filled('search')) { $assets->TextSearch($request->input('search')); } - + // Search custom fields by column name foreach ($all_custom_fields as $field) { if ($request->filled($field->db_column_name())) { @@ -1101,6 +1100,7 @@ class AssetsController extends Controller break; } + $assets->requestableAssets(); // Make sure the offset and limit are actually integers and do not exceed system limits $offset = ($request->input('offset') > $assets->count()) ? $assets->count() : app('api_offset_value');