Fixes #3825 - allows fillables through location API

This commit is contained in:
snipe 2017-08-08 12:36:28 -07:00
parent 9bfd345774
commit 7da4fe4524
2 changed files with 3 additions and 3 deletions

View file

@ -70,7 +70,7 @@ class LocationsController extends Controller
$location->fill($request->all()); $location->fill($request->all());
if ($location->save()) { 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())); return response()->json(Helper::formatStandardApiResponse('error', null, $location->getErrors()));
@ -108,7 +108,7 @@ class LocationsController extends Controller
$location->fill($request->all()); $location->fill($request->all());
if ($location->save()) { 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())); return response()->json(Helper::formatStandardApiResponse('error', null, $location->getErrors()));

View file

@ -43,7 +43,7 @@ class Location extends SnipeModel
* *
* @var array * @var array
*/ */
protected $fillable = ['name']; protected $fillable = ['name','parent_id','address','address2','city','state', 'country','zip','ldap_ou'];
protected $hidden = ['user_id']; protected $hidden = ['user_id'];
public function users() public function users()