Skip to content

A free open source IT asset/license management system

Fixes #3825 - allows fillables through location API

snipe7da4fe452490
diff --git a/app/Http/Controllers/Api/LocationsController.php b/app/Http/Controllers/Api/LocationsController.php
index ad3f139f4d..e5f5209fa6 100644
--- a/app/Http/Controllers/Api/LocationsController.php
+++ b/app/Http/Controllers/Api/LocationsController.php
@@ -70,7 +70,7 @@ class LocationsController extends Controller
$location->fill($request->all());
if ($location->save()) {
- return response()->json(Helper::formatStandardApiResponse('success', $location, trans('admin/locations/message.create.success')));
+ return response()->json(Helper::formatStandardApiResponse('success', (new LocationsTransformer)->transformLocation($location), trans('admin/locations/message.create.success')));
}
return response()->json(Helper::formatStandardApiResponse('error', null, $location->getErrors()));
@@ -108,7 +108,7 @@ class LocationsController extends Controller
$location->fill($request->all());
if ($location->save()) {
- return response()->json(Helper::formatStandardApiResponse('success', $location, trans('admin/locations/message.update.success')));
+ return response()->json(Helper::formatStandardApiResponse('success', (new LocationsTransformer)->transformLocation($location), trans('admin/locations/message.update.success')));
}
return response()->json(Helper::formatStandardApiResponse('error', null, $location->getErrors()));
diff --git a/app/Models/Location.php b/app/Models/Location.php
index aeb49acccb..2a102a2d88 100755
--- a/app/Models/Location.php
+++ b/app/Models/Location.php
@@ -43,7 +43,7 @@ class Location extends SnipeModel
*
* @var array
*/
- protected $fillable = ['name'];
+ protected $fillable = ['name','parent_id','address','address2','city','state', 'country','zip','ldap_ou'];
protected $hidden = ['user_id'];
public function users()