From 7eef1b4bcf7c3cc6acdd738d48ee1401a35170e1 Mon Sep 17 00:00:00 2001 From: snipe Date: Fri, 10 Nov 2017 15:56:14 -0800 Subject: [PATCH] Fixed #4418 - order models by name asc in selectlist --- app/Http/Controllers/Api/AssetModelsController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Api/AssetModelsController.php b/app/Http/Controllers/Api/AssetModelsController.php index 637d13d61d..f38118ba6f 100644 --- a/app/Http/Controllers/Api/AssetModelsController.php +++ b/app/Http/Controllers/Api/AssetModelsController.php @@ -188,14 +188,14 @@ class AssetModelsController extends Controller 'models.name', 'models.image', 'models.model_number', - ]); + ])->with('manufacturer'); if ($request->has('search')) { $assetmodels = $assetmodels->where('models.name', 'LIKE', '%'.$request->get('search').'%') ->orWhere('models.model_number', 'LIKE', '%'.$request->get('search').'%'); } - $assetmodels = $assetmodels->paginate(50); + $assetmodels = $assetmodels->orderby('models.name', 'asc')->orderby('models.model_number', 'asc')->paginate(50); foreach ($assetmodels as $assetmodel) { $assetmodel->use_text = $assetmodel->present()->modelName;