/** * Group update form processing page. * * @param int $id * @return Redirect */ public function update($id = null, GroupRequest $request) { try { // Get the group information $group = Sentinel::findRoleById($id); } catch (GroupNotFoundException $e) { // Redirect to the groups management page return Rediret::route('groups')->with('error', Lang::get('groups/message.group_not_found', compact('id'))); } // Update the group data $group->name = Input::get('name'); // Was the group updated? if ($group->save()) { // Redirect to the group page return Redirect::route('groups')->with('success', Lang::get('groups/message.success.update')); } else { // Redirect to the group page return Redirect::route('update/group', $id)->with('error', Lang::get('groups/message.error.update')); } }
/** * Role update form processing page. * * @param int $id * @return Redirect */ public function update($id = null, RoleRequest $request) { try { // Get the role information $role = Sentinel::findRoleById($id); } catch (RoleNotFoundException $e) { // Redirect to the roles management page return Rediret::route('roles')->with('error', Lang::get('roles/message.role_not_found', compact('id'))); } // Update the role data $role->name = Input::get('name'); // Was the role updated? if ($role->save()) { // Redirect to the role page return Redirect::route('roles')->with('success', Lang::get('roles/message.success.update')); } else { // Redirect to the role page return Redirect::route('update/role', $id)->with('error', Lang::get('roles/message.error.update')); } }
/** * Group update form processing page. * * @param int $id * @return Redirect */ public function postEdit($id = null) { // We need to reverse the UI specific logic for our // permissions here before we update the group. $permissions = Input::get('permissions', array()); $this->decodePermissions($permissions); app('request')->request->set('permissions', $permissions); try { // Get the group information $group = Sentry::getGroupProvider()->findById($id); } catch (GroupNotFoundException $e) { // Redirect to the groups management page return Rediret::route('groups')->with('error', Lang::get('admin/groups/message.group_not_found', compact('id'))); } // Declare the rules for the form validation $rules = array('name' => 'required|alpha_space|min:2'); // Create a new validator instance from our validation rules $validator = Validator::make(Input::all(), $rules); // If validation fails, we'll exit the operation now. if ($validator->fails()) { // Ooops.. something went wrong return Redirect::back()->withInput()->withErrors($validator); } try { // Update the group data $group->name = Input::get('name'); $group->permissions = Input::get('permissions'); // Was the group updated? if ($group->save()) { // Redirect to the group page return Redirect::route('update/group', $id)->with('success', Lang::get('admin/groups/message.success.update')); } else { // Redirect to the group page return Redirect::route('update/group', $id)->with('error', Lang::get('admin/groups/message.error.update')); } } catch (NameRequiredException $e) { $error = Lang::get('admin/group/message.group_name_required'); } // Redirect to the group page return Redirect::route('update/group', $id)->withInput()->with('error', $error); }
/** * Group update form processing page. * * @param int $id * @return Redirect */ public function postEdit($id = null) { try { // Get the group information $group = Sentinel::findRoleById($id); } catch (GroupNotFoundException $e) { // Redirect to the groups management page return Rediret::route('groups')->with('error', Lang::get('groups/message.group_not_found', compact('id'))); } // Declare the rules for the form validation $rules = array('name' => 'required'); // Create a new validator instance from our validation rules $validator = Validator::make(Input::all(), $rules); // If validation fails, we'll exit the operation now. if ($validator->fails()) { // Ooops.. something went wrong return Redirect::back()->withInput()->withErrors($validator); } // Update the group data $group->name = Input::get('name'); // Was the group updated? if ($group->save()) { // Redirect to the group page return Redirect::route('groups')->with('success', Lang::get('groups/message.success.update')); } else { // Redirect to the group page return Redirect::route('update/group', $id)->with('error', Lang::get('groups/message.error.update')); } }