From 02720f225c39844d8c9255bae1ce64a77907fdc4 Mon Sep 17 00:00:00 2001 From: snipe Date: Mon, 30 Oct 2017 20:51:01 -0700 Subject: [PATCH] Fixed sorting issue in asset models when ordering by manufacturer --- app/Http/Controllers/Api/AssetModelsController.php | 2 +- app/Models/AssetModel.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Api/AssetModelsController.php b/app/Http/Controllers/Api/AssetModelsController.php index 8b81947d2a..ef79689ac8 100644 --- a/app/Http/Controllers/Api/AssetModelsController.php +++ b/app/Http/Controllers/Api/AssetModelsController.php @@ -55,7 +55,7 @@ class AssetModelsController extends Controller $assetmodels->OrderManufacturer($order); break; default: - $assetmodels->orderBy($sort, $order); + $assetmodels->orderBy('models'.$sort, $order); break; } diff --git a/app/Models/AssetModel.php b/app/Models/AssetModel.php index e353a149aa..aa485399d8 100755 --- a/app/Models/AssetModel.php +++ b/app/Models/AssetModel.php @@ -149,7 +149,7 @@ class AssetModel extends SnipeModel public function scopeTextSearch($query, $search) { - return $query->where('name', 'LIKE', "%$search%") + return $query->where('models.name', 'LIKE', "%$search%") ->orWhere('model_number', 'LIKE', "%$search%") ->orWhere(function ($query) use ($search) { $query->whereHas('depreciation', function ($query) use ($search) {