public function nearest_by_coords_post() { try { if (!$this->post('lat') || !$this->post('lng') || !$this->post('radius')) { $this->response('Missing Parameters', 400); } $this->response($this->model->get_nearest($this->post('lat'), $this->post('lng'), $this->post('radius')), 200); } catch (Exception $e) { $this->response($e->getMessage(), $e->getCode()); } }