Removed commented code

This commit is contained in:
snipe 2017-07-12 19:22:58 -07:00
parent 3cfcc43efa
commit b13e04095e
2 changed files with 26 additions and 1 deletions

View file

@ -74,7 +74,6 @@ class AssetModelsController extends Controller
$this->authorize('create', AssetModel::class); $this->authorize('create', AssetModel::class);
$assetmodel = new AssetModel; $assetmodel = new AssetModel;
$assetmodel->fill($request->all()); $assetmodel->fill($request->all());
//$assetmodel->fieldset_id = $request->get("custom_fieldset_id");
if ($assetmodel->save()) { if ($assetmodel->save()) {
return response()->json(Helper::formatStandardApiResponse('success', $assetmodel, trans('admin/assetmodels/message.create.success'))); return response()->json(Helper::formatStandardApiResponse('success', $assetmodel, trans('admin/assetmodels/message.create.success')));

View file

@ -69,4 +69,30 @@ class CustomFieldsetsController extends Controller
} }
/**
* Delete a custom fieldset.
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @since [v4.0]
* @return Redirect
*/
public function destroy($id)
{
$this->authorize('delete', CustomFieldset::class);
$fieldset = CustomFieldset::findOrFail($id);
$modelsCount = $fieldset->models->count();
$fieldsCount = $fieldset->fields->count();
if (($modelsCount > 0) || ($fieldsCount > 0) ){
return response()->json(Helper::formatStandardApiResponse('error', null, 'Fieldset is in use.'));
} else {
$fieldset->delete();
return response()->json(Helper::formatStandardApiResponse('success', null, trans('admin/custom_fields/message.fieldset.delete.success')));
}
}
} }