mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 05:34:06 -08:00
Add the pertinent filters in Accessories and Consumables controllers
This commit is contained in:
parent
75d4a46fff
commit
38a2a0c1ee
|
@ -51,6 +51,10 @@ class AccessoriesController extends Controller
|
||||||
$accessories->where('supplier_id','=',$request->input('supplier_id'));
|
$accessories->where('supplier_id','=',$request->input('supplier_id'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($request->filled('location_id')) {
|
||||||
|
$accessories->where('location_id','=',$request->input('location_id'));
|
||||||
|
}
|
||||||
|
|
||||||
// Set the offset to the API call's offset, unless the offset is higher than the actual count of items in which
|
// Set the offset to the API call's offset, unless the offset is higher than the actual count of items in which
|
||||||
// case we override with the actual count, so we should return 0 items.
|
// case we override with the actual count, so we should return 0 items.
|
||||||
$offset = (($accessories) && ($request->get('offset') > $accessories->count())) ? $accessories->count() : $request->get('offset', 0);
|
$offset = (($accessories) && ($request->get('offset') > $accessories->count())) ? $accessories->count() : $request->get('offset', 0);
|
||||||
|
|
|
@ -46,6 +46,10 @@ class ConsumablesController extends Controller
|
||||||
$consumables->where('manufacturer_id','=',$request->input('manufacturer_id'));
|
$consumables->where('manufacturer_id','=',$request->input('manufacturer_id'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($request->filled('location_id')) {
|
||||||
|
$consumables->where('location_id','=',$request->input('location_id'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Set the offset to the API call's offset, unless the offset is higher than the actual count of items in which
|
// Set the offset to the API call's offset, unless the offset is higher than the actual count of items in which
|
||||||
// case we override with the actual count, so we should return 0 items.
|
// case we override with the actual count, so we should return 0 items.
|
||||||
|
|
Loading…
Reference in a new issue