diff --git a/app/Http/Controllers/Api/LocationsController.php b/app/Http/Controllers/Api/LocationsController.php index 2a6b19eefe..3a8df10587 100644 --- a/app/Http/Controllers/Api/LocationsController.php +++ b/app/Http/Controllers/Api/LocationsController.php @@ -27,7 +27,7 @@ class LocationsController extends Controller $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_location_count', 'rtd_assets_count', 'currency', 'ldap_ou', ]; + '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', @@ -46,7 +46,7 @@ class LocationsController extends Controller 'locations.ldap_ou', 'locations.currency', ])->withCount('assignedAssets as assigned_assets_count') - ->withCount('assets as assets_location_count') + ->withCount('assets as assets_count') ->withCount('rtd_assets as rtd_assets_count') ->withCount('users as users_count'); @@ -157,7 +157,7 @@ class LocationsController extends Controller 'locations.currency', ]) ->withCount('assignedAssets as assigned_assets_count') - ->withCount('assets as assets_location_count') + ->withCount('assets as assets_count') ->withCount('rtd_assets as rtd_assets_count') ->withCount('users as users_count') ->findOrFail($id); diff --git a/app/Http/Transformers/LocationsTransformer.php b/app/Http/Transformers/LocationsTransformer.php index 8d6a1315cf..a55c41b350 100644 --- a/app/Http/Transformers/LocationsTransformer.php +++ b/app/Http/Transformers/LocationsTransformer.php @@ -44,7 +44,7 @@ class LocationsTransformer 'country' => ($location->country) ? e($location->country) : null, 'zip' => ($location->zip) ? e($location->zip) : null, 'assigned_assets_count' => (int) $location->assigned_assets_count, - 'assets_location_count' => (int) $location->assets_location_count, + 'assets_count' => (int) $location->assets_count, 'rtd_assets_count' => (int) $location->rtd_assets_count, 'users_count' => (int) $location->users_count, 'currency' => ($location->currency) ? e($location->currency) : null, diff --git a/app/Presenters/LocationPresenter.php b/app/Presenters/LocationPresenter.php index 892775edee..d4281839a1 100644 --- a/app/Presenters/LocationPresenter.php +++ b/app/Presenters/LocationPresenter.php @@ -51,7 +51,7 @@ class LocationPresenter extends Presenter ], [ - 'field' => 'assets_location_count', + 'field' => 'assets_count', 'searchable' => false, 'sortable' => true, 'switchable' => true,