public function create_post() { try { $data = $this->post(); $data['users_id'] = $this->user_id; $create_result = $this->model->create_event($data); if ($create_result['errors']) { $this->response($create_result, 400); } $create_result['data'] = $this->model->get_event($create_result['data']['id']); $this->response($create_result, 200); } catch (Exception $e) { $this->response($e->getMessage(), $e->getCode()); } }