diff --git a/app/Http/Controllers/Api/LocationsController.php b/app/Http/Controllers/Api/LocationsController.php index 73227e0825..9b07813f76 100644 --- a/app/Http/Controllers/Api/LocationsController.php +++ b/app/Http/Controllers/Api/LocationsController.php @@ -248,6 +248,7 @@ class LocationsController extends Controller ->withCount('rtd_assets as rtd_assets_count') ->withCount('children as children_count') ->withCount('users as users_count') + ->withCount('checkouts as accessories_count') ->findOrFail($id); if (! $location->isDeletable()) { diff --git a/app/Models/Location.php b/app/Models/Location.php index 67131902a1..b03fae60d9 100755 --- a/app/Models/Location.php +++ b/app/Models/Location.php @@ -111,6 +111,7 @@ class Location extends SnipeModel && ($this->assets_count === 0) && ($this->assigned_assets_count === 0) && ($this->children_count === 0) + && ($this->accessories_count === 0) && ($this->users_count === 0); }