A free open source IT asset/license management system
Merge branch 'develop' into feature/locations_with_companies
snipeb6f05bff1f54
diff --cc app/Http/Controllers/Api/LocationsController.phpindex eb6d720f1a,f4f788d563..40f1ebc3cd--- a/app/Http/Controllers/Api/LocationsController.php+++ b/app/Http/Controllers/Api/LocationsController.php@@@ -8,10 -9,11 +9,13 @@@ use App\Http\Transformers\AccessoriesTruse App\Http\Transformers\AssetsTransformer;use App\Http\Transformers\LocationsTransformer;use App\Http\Transformers\SelectlistTransformer;+ use App\Models\Accessory;+ use App\Models\AccessoryCheckout;use App\Models\Asset;+use App\Models\Company;use App\Models\Location;+use App\Models\Setting;+ use Illuminate\Http\JsonResponse;use Illuminate\Http\Request;use Illuminate\Pagination\LengthAwarePaginator;use Illuminate\Support\Collection;@@@ -30,27 -31,28 +33,29 @@@ class LocationsController extends Contr{$this->authorize('view', Location::class);$allowed_columns = [- 'id',- 'name',+ 'accessories_count','address','address2',+ 'assets_count',+ 'assets_count',+ 'assigned_accessories_count',+ 'assigned_assets_count',+ 'assigned_assets_count','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',+ 'id',+ 'image','ldap_ou',+ 'company_id',+ 'manager_id',+ 'name',+ 'rtd_assets_count',+ 'state',+ 'updated_at',+ 'users_count',+ 'zip',];$locations = Location::with('parent', 'manager', 'children')->select([@@@ -71,9 -73,11 +76,13 @@@'locations.image','locations.ldap_ou','locations.currency',+ 'locations.company_id',- ])->withCount('assignedAssets as assigned_assets_count')+ ])++ ->withCount('assignedAssets as assigned_assets_count')+ ->withCount('assignedAssets as assigned_assets_count')->withCount('assets as assets_count')+ ->withCount('assignedAccessories as assigned_accessories_count')+ ->withCount('accessories as accessories_count')->withCount('rtd_assets as rtd_assets_count')->withCount('children as children_count')->withCount('users as users_count');