From e286ff0be3aad559219c01deb1260eb3644e4111 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 20 Apr 2021 15:09:23 -0700 Subject: [PATCH] Added show() redirect for CustomFields::show() Signed-off-by: snipe --- .../Controllers/CustomFieldsController.php | 30 +++++++++++++++---- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/app/Http/Controllers/CustomFieldsController.php b/app/Http/Controllers/CustomFieldsController.php index e58e00c193..cf338dbb59 100644 --- a/app/Http/Controllers/CustomFieldsController.php +++ b/app/Http/Controllers/CustomFieldsController.php @@ -40,6 +40,24 @@ class CustomFieldsController extends Controller } + /** + * Just redirect the user back if they try to view the details of a field. + * We already show those details on the listing page. + * + * @see CustomFieldsController::storeField() + * @author [A. Gianotto] [] + * @since [v5.1.5] + * @return Redirect + * @throws \Illuminate\Auth\Access\AuthorizationException + */ + + public function show() + { + return redirect()->route("fields.index"); + + } + + /** * Returns a view with a form to create a new custom field. * @@ -135,15 +153,15 @@ class CustomFieldsController extends Controller { $field = CustomField::find($field_id); - $this->authorize('delete', $field); + $this->authorize('delete', $field); if ($field->fieldset->count()>0) { - return redirect()->back()->withErrors(['message' => "Field is in-use"]); + return redirect()->back()->withErrors(['message' => "Field is in-use"]); + } + $field->delete(); + return redirect()->route("fields.index") + ->with("success", trans('admin/custom_fields/message.field.delete.success')); } - $field->delete(); - return redirect()->route("fields.index") - ->with("success", trans('admin/custom_fields/message.field.delete.success')); - } /**