public function updateUser(User $user) { $inputs = ['email' => Input::get('email'), 'username' => Input::get('username'), 'password' => Input::get('password'), 'password_confirmation' => Input::get('password_confirmation')]; $valid = Validator::make($inputs, User::$rulesUpd); if (User::cmpPassword($inputs['password'], $inputs['password_confirmation']) == 1) { return Redirect::back()->withErrors(trans('messages.PACANE')); } if (isset($inputs['username']) && $user->checkUsername($inputs['username']) == 1) { return Redirect::back()->withErrors(trans('messages.TUAXTAO')); } if (isset($inputs['email']) && $user->checkEmail($inputs['email']) == 1) { return Redirect::back()->withErrors(trans('messages.TEAXTAO')); } if ($valid->passes()) { $user->username = $inputs['username']; $user->email = $inputs['email']; if (isset($inputs['password']) && $inputs['password'] != '') { $user->password = Hash::make($inputs['password']); } $user->save(); return Redirect::back()->with('success', Lang::choice('messages.Users', 1) . ' ' . trans('messages.is updated')); } else { return Redirect::back()->withErrors($valid)->withInput(); } }