mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-24 21:24:13 -08:00
Fixed #4418 - order models by name asc in selectlist
This commit is contained in:
parent
bb4d49690f
commit
7eef1b4bcf
|
@ -188,14 +188,14 @@ class AssetModelsController extends Controller
|
||||||
'models.name',
|
'models.name',
|
||||||
'models.image',
|
'models.image',
|
||||||
'models.model_number',
|
'models.model_number',
|
||||||
]);
|
])->with('manufacturer');
|
||||||
|
|
||||||
|
|
||||||
if ($request->has('search')) {
|
if ($request->has('search')) {
|
||||||
$assetmodels = $assetmodels->where('models.name', 'LIKE', '%'.$request->get('search').'%')
|
$assetmodels = $assetmodels->where('models.name', 'LIKE', '%'.$request->get('search').'%')
|
||||||
->orWhere('models.model_number', '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) {
|
foreach ($assetmodels as $assetmodel) {
|
||||||
$assetmodel->use_text = $assetmodel->present()->modelName;
|
$assetmodel->use_text = $assetmodel->present()->modelName;
|
||||||
|
|
Loading…
Reference in a new issue