Fixed bad groups route on error

This commit is contained in:
snipe 2019-01-24 14:56:47 -08:00
parent d1fe7abb18
commit b326d8593b

View file

@ -66,7 +66,7 @@ class GroupsController extends Controller
if ($group->save()) { if ($group->save()) {
return redirect()->route("groups.index")->with('success', trans('admin/groups/message.success.create')); return redirect()->route("groups.index")->with('success', trans('admin/groups/message.success.create'));
} }
return redirect(route('groups.create'))->withInput()->withErrors($group->getErrors()); return redirect()->route('groups.create')->withInput()->withErrors($group->getErrors());
} }
/** /**
@ -104,7 +104,7 @@ class GroupsController extends Controller
public function update($id = null) public function update($id = null)
{ {
if (!$group = Group::find($id)) { if (!$group = Group::find($id)) {
return redirect()->route('groups')->with('error', trans('admin/groups/message.group_not_found', compact('id'))); return redirect()->route('groups.index')->with('error', trans('admin/groups/message.group_not_found', compact('id')));
} }
$group->name = e(Input::get('name')); $group->name = e(Input::get('name'));
$group->permissions = json_encode(Input::get('permission')); $group->permissions = json_encode(Input::get('permission'));
@ -132,7 +132,7 @@ class GroupsController extends Controller
{ {
if (!config('app.lock_passwords')) { if (!config('app.lock_passwords')) {
if (!$group = Group::find($id)) { if (!$group = Group::find($id)) {
return redirect()->route('groups')->with('error', trans('admin/groups/message.group_not_found', compact('id'))); return redirect()->c->with('error', trans('admin/groups/message.group_not_found', compact('id')));
} }
$group->delete(); $group->delete();
// Redirect to the group management page // Redirect to the group management page