A free open source IT asset/license management system
Added assets endpoint
snipe021c4f259857
diff --git a/app/Http/Controllers/Api/LocationsController.php b/app/Http/Controllers/Api/LocationsController.phpindex 52ef4ab937..f4f788d563 100644--- a/app/Http/Controllers/Api/LocationsController.php+++ b/app/Http/Controllers/Api/LocationsController.php@@ -232,7 +232,17 @@ class LocationsController extends Controllerreturn response()->json(Helper::formatStandardApiResponse('error', null, $location->getErrors()));}+public function assets(Request $request, Location $location) : JsonResponse | array+ {+ $this->authorize('view', Asset::class);+ $this->authorize('view', $location);+ $assets = Asset::where('location_id', '=', $location->id)->with('model', 'model.category', 'assetstatus', 'location', 'company', 'defaultLoc');+ $assets = $assets->get();+ return (new AssetsTransformer)->transformAssets($assets, $assets->count(), $request);+ }++ public function assignedAssets(Request $request, Location $location) : JsonResponse | array{$this->authorize('view', Asset::class);$this->authorize('view', $location);