public function post_change_password(Request $request, ThreeStepUser $three_step_user, ThreeStepAdmin $three_step_admin) { $validation_rules = $three_step_admin->getValidationRulesChangePassword(); $this->validate($request, $validation_rules); $arr_request = $three_step_admin->getRequestArrayChangePassword($request); $three_step_user = $three_step_user->where('role_id', 1)->first(); if (!$three_step_user == null) { if (!Hash::check($arr_request['curr_password'], $three_step_user->password)) { $data = $three_step_admin->getDataArrayChangePassword('The current password does not match our records', $this->arr_logged_in_user); return view('three_step_admin/change_password')->with('data', $data); } else { $three_step_user->password = Hash::make($arr_request['password']); $three_step_user->save(); $data = $three_step_admin->getDataArrayChangePassword(null, $this->arr_logged_in_user); return view('three_step_admin/change_password_results')->with('data', $data); } // end else, if ! Hash::check } else { $data = $three_step_admin->getDataArrayChangePassword('No three step user found.', $this->arr_logged_in_user); return view('three_step_admin/change_password')->with('data', $data); } }