3
0
mirror of https://github.com/snipe/snipe-it.git synced 2026-05-06 14:45:40 +00:00

Moved search scope lower to fix weird (possible Laravel) bug w/prepared statements

This commit is contained in:
snipe
2018-01-11 15:17:34 -08:00
parent a4b32e2328
commit 9293f17707
4 changed files with 34 additions and 22 deletions

View File

@ -36,14 +36,15 @@ class AssetModelsController extends Controller
->with('category','depreciation', 'manufacturer','fieldset')
->withCount('assets');
if ($request->has('search')) {
$assetmodels->TextSearch($request->input('search'));
}
if ($request->has('status')) {
$assetmodels->onlyTrashed();
}
if ($request->has('search')) {
$assetmodels->TextSearch($request->input('search'));
}
$offset = $request->input('offset', 0);
$limit = $request->input('limit', 50);
@ -60,6 +61,7 @@ class AssetModelsController extends Controller
}
$total = $assetmodels->count();
$assetmodels = $assetmodels->skip($offset)->take($limit)->get();
return (new AssetModelsTransformer)->transformAssetModels($assetmodels, $total);