public function profile_put() { $this->auth(); try { if (!$this->put()) { throw new Exception('Empty Request', 400); } $profile = $this->model->get_profile($this->user_id); $update_result = $this->model->update_profile($this->user_id, $this->put()); if ($update_result['errors']) { $this->response($update_result, 400); } $update_result['profile'] = array_merge($profile, $this->put()); unset($update_result['profile']['password']); unset($update_result['profile']['pass2']); $this->response($update_result, 200); } catch (Exception $e) { $this->response($e->getMessage(), $e->getCode()); } }