old('permissions', $groupPermissions); // Show the page return view('groups/edit', compact('permissions', 'selectedPermissions', 'groupPermissions'))->with('group', $group); } /** * Validates and stores the new User Group data. * * @author [A. Gianotto] [name = $request->input('name'); $group->permissions = json_encode($request->input('permission')); $group->created_by = Auth::user()->id; if ($group->save()) { return redirect()->route('groups.index')->with('success', trans('admin/groups/message.success.create')); } return redirect()->back()->withInput()->withErrors($group->getErrors()); } /** * Returns a view that presents a form to edit a User Group. * * @author [A. Gianotto] [decodePermissions(); $selected_array = Helper::selectedPermissionsArray($permissions, $groupPermissions); return view('groups.edit', compact('group', 'permissions', 'selected_array', 'groupPermissions')); } return redirect()->route('groups.index')->with('error', trans('admin/groups/message.group_not_found', ['id' => $id])); } /** * Validates and stores the updated User Group data. * * @author [A. Gianotto] [route('groups.index')->with('error', trans('admin/groups/message.group_not_found', ['id' => $id])); } $group->name = $request->input('name'); $group->permissions = json_encode($request->input('permission')); if (! config('app.lock_passwords')) { if ($group->save()) { return redirect()->route('groups.index')->with('success', trans('admin/groups/message.success.update')); } return redirect()->back()->withInput()->withErrors($group->getErrors()); } return redirect()->route('groups.index')->with('error', trans('general.feature_disabled')); } /** * Validates and deletes the User Group. * * @author [A. Gianotto] [route('groups.index')->with('error', trans('admin/groups/message.group_not_found', ['id' => $id])); } $group->delete(); return redirect()->route('groups.index')->with('success', trans('admin/groups/message.success.delete')); } return redirect()->route('groups.index')->with('error', trans('general.feature_disabled')); } /** * Returns a view that invokes the ajax tables which actually contains * the content for the group detail page. * * @author [A. Gianotto] [] * @param $id * @return \Illuminate\Contracts\View\View * @since [v4.0.11] */ public function show($id) { $group = Group::find($id); if ($group) { return view('groups/view', compact('group')); } return redirect()->route('groups.index')->with('error', trans('admin/groups/message.group_not_found', ['id' => $id])); } }