Fixed sorting issue in asset models when ordering by manufacturer

This commit is contained in:
snipe 2017-10-30 20:51:01 -07:00
parent e44e573a3c
commit 02720f225c
2 changed files with 2 additions and 2 deletions

View file

@ -55,7 +55,7 @@ class AssetModelsController extends Controller
$assetmodels->OrderManufacturer($order); $assetmodels->OrderManufacturer($order);
break; break;
default: default:
$assetmodels->orderBy($sort, $order); $assetmodels->orderBy('models'.$sort, $order);
break; break;
} }

View file

@ -149,7 +149,7 @@ class AssetModel extends SnipeModel
public function scopeTextSearch($query, $search) public function scopeTextSearch($query, $search)
{ {
return $query->where('name', 'LIKE', "%$search%") return $query->where('models.name', 'LIKE', "%$search%")
->orWhere('model_number', 'LIKE', "%$search%") ->orWhere('model_number', 'LIKE', "%$search%")
->orWhere(function ($query) use ($search) { ->orWhere(function ($query) use ($search) {
$query->whereHas('depreciation', function ($query) use ($search) { $query->whereHas('depreciation', function ($query) use ($search) {