A free open source IT asset/license management system
Added manager ID to filter
snipe1e602793b2f6
diff --git a/app/Http/Controllers/Api/LocationsController.php b/app/Http/Controllers/Api/LocationsController.phpindex b888493286..e1c79dfbe4 100644--- a/app/Http/Controllers/Api/LocationsController.php+++ b/app/Http/Controllers/Api/LocationsController.php@@ -25,9 +25,27 @@ class LocationsController extends Controller{$this->authorize('view', Location::class);$allowed_columns = [- 'id', 'name', 'address', 'address2', 'city', 'state', 'country', 'zip', 'created_at',- 'updated_at', 'manager_id', 'image',- 'assigned_assets_count', 'users_count', 'assets_count','assigned_assets_count', 'assets_count', 'rtd_assets_count', 'currency', 'ldap_ou', ];+ 'id',+ 'name',+ 'address',+ 'address2',+ 'city',+ 'state',+ 'country',+ 'zip',+ 'created_at',+ 'updated_at',+ 'manager_id',+ 'image',+ 'assigned_assets_count',+ 'users_count',+ 'assets_count',+ 'assigned_assets_count',+ 'assets_count',+ 'rtd_assets_count',+ 'currency',+ 'ldap_ou',+ ];$locations = Location::with('parent', 'manager', 'children')->select(['locations.id',@@ -50,6 +68,7 @@ class LocationsController extends Controller])->withCount('assignedAssets as assigned_assets_count')->withCount('assets as assets_count')->withCount('rtd_assets as rtd_assets_count')+ ->withCount('children as children_count')->withCount('users as users_count');if ($request->filled('search')) {@@ -80,6 +99,10 @@ class LocationsController extends Controller$locations->where('locations.country', '=', $request->input('country'));}+ if ($request->filled('manager_id')) {+ $locations->where('locations.manager_id', '=', $request->input('manager_id'));+ }+// Make sure the offset and limit are actually integers and do not exceed system limits$offset = ($request->input('offset') > $locations->count()) ? $locations->count() : app('api_offset_value');$limit = app('api_limit_value');