Skip to content

Commit

Permalink
Merge pull request #886 from madd15/Fix---Edit-user
Browse files Browse the repository at this point in the history
Fix - Edit User
  • Loading branch information
snipe committed Jul 2, 2015
2 parents be68546 + 7a0b3a7 commit d4af197
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions app/controllers/admin/UsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,15 @@ public function postEdit($id = null)
return Redirect::route('users')->with('error', $error);
}

//
$this->validationRules['email'] = "required|email|unique:users,email,{$user->email},email";
//Check if username is the same then unset validationRules
if (Input::get('username') == $user->username) {
unset($this->validationRules['username']);
}

//Check if email is the same then unset validationRules
if ($user->email == Input::get('email')) {
unset($this->validationRules['email']);
}

// Do we want to update the user password?
if ( ! $password = Input::get('password')) {
Expand All @@ -285,16 +292,18 @@ public function postEdit($id = null)

try {
// Update the user
$user->first_name = Input::get('first_name');
$user->first_name = Input::get('first_name');
$user->last_name = Input::get('last_name');
$user->username = Input::get('username');
$user->email = Input::get('email');
$user->employee_num = Input::get('employee_num');
$user->activated = Input::get('activated', $user->activated);
$user->permissions = Input::get('permissions');
$user->jobtitle = Input::get('jobtitle');
$user->phone = Input::get('phone');
$user->location_id = Input::get('location_id');
$user->manager_id = Input::get('manager_id');
$user->notes = Input::get('notes');
$user->notes = Input::get('notes');

if ($user->manager_id == "") {
$user->manager_id = NULL;
Expand Down

0 comments on commit d4af197

Please sign in to comment.