From ed4ea7f1f4f3f6b72c5e0c47b4ffdbf07a22f032 Mon Sep 17 00:00:00 2001 From: Iman Date: Tue, 12 Sep 2017 23:58:42 +0430 Subject: [PATCH] No new feature,No bug fix, Only refactoring (#3949) * No change in logic ! Just exchanging the if and else code blocks and negating condition. * remove unneeded else{} block * Re-indented the code --- app/Http/Controllers/GroupsController.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/app/Http/Controllers/GroupsController.php b/app/Http/Controllers/GroupsController.php index 7f7781faf6..39ed99b3d8 100755 --- a/app/Http/Controllers/GroupsController.php +++ b/app/Http/Controllers/GroupsController.php @@ -116,16 +116,14 @@ class GroupsController extends Controller $group->permissions = json_encode(Input::get('permission')); - if (!config('app.lock_passwords')) { - - if ($group->save()) { - return redirect()->to("admin/groups")->with('success', trans('admin/groups/message.success.update')); - } - return redirect()->back()->withInput()->withErrors($group->getErrors()); - - } else { + if (config('app.lock_passwords')) { return redirect()->route('update/group', $id)->withInput()->with('error', 'Denied! Editing groups is not allowed in the demo.'); } + if ($group->save()) { + return redirect()->to("admin/groups")->with('success', trans('admin/groups/message.success.update')); + } + return redirect()->back()->withInput()->withErrors($group->getErrors()); + }