table('KPDL_V_BATAS_DESA')->where('ADM1_PCODE IS NOT NULL')->select('ADM1_PCODE as value, ADM1_EN as label')->distinct()->orderBy('ADM1_EN')->get()->getResult(); foreach ($data as $key => $val) { $val->value = $val->value; } return json_encode($data); } public function kota() { $db = \Config\Database::connect(); $data = $db->table('KPDL_V_BATAS_DESA') ->select('ADM2_PCODE as value, ADM2_EN as label') ->distinct() ->where('ADM2_PCODE IS NOT NULL') ->where('ADM1_PCODE', $this->request->getGet('prop')) ->orderBy('ADM2_EN')->get()->getResult(); return json_encode($data); } public function kecamatan() { $db = \Config\Database::connect(); $data = $db->table('KPDL_V_BATAS_DESA') ->select('ADM3_PCODE as value, ADM3_EN as label') ->distinct() ->where('ADM3_PCODE IS NOT NULL') ->where('ADM2_PCODE', $this->request->getGet('kota')) ->orderBy('ADM3_EN')->get()->getResult(); return json_encode($data); } public function kelurahan() { $db = \Config\Database::connect(); $data = $db->table('KPDL_V_BATAS_DESA') ->select('ADM4_PCODE as value, ADM4_EN as label') ->distinct() ->where('ADM4_PCODE IS NOT NULL') ->whereIn('ADM3_PCODE', $this->request->getGet('kec')) ->orderBy('ADM4_EN')->get()->getResult(); return json_encode($data); } public function zpkanwil() { $db = \Config\Database::connect(); $data = $db->table('KPDL_ZP_NAS_DIFF') ->select('KD_KANWIL as value, NM_KANWIL as label') ->distinct() ->orderBy('NM_KANWIL')->get()->getResult(); foreach ($data as $key => $val) { $val->value = $val->value; } return json_encode($data); } public function zpkpp() { $db = \Config\Database::connect(); $data = $db->table('KPDL_ZP_NAS_DIFF') ->select('KD_KPP as value, NM_KPP as label') ->distinct() ->where('KD_KANWIL', $this->request->getGet('kanwil')) ->orderBy('NM_KPP')->get()->getResult(); return json_encode($data); } public function zpseksi() { $db = \Config\Database::connect(); $data = $db->table('KPDL_ZP_NAS_DIFF') ->select('KD_UNIT_OR as value, SEKSI as label') ->distinct() ->whereIn('KD_KPP', $this->request->getGet('kpp')) ->orderBy('SEKSI')->get()->getResult(); return json_encode($data); } public function zpar() { $db = \Config\Database::connect(); $kpp = $this->request->getGet('kpp'); $seksi = $this->request->getGet('seksi'); $data = $db->table('KPDL_ZP_NAS_DIFF') ->select('NIP_AR as value, NM_AR as label') ->distinct() ->whereIn('KD_KPP', $kpp) ->whereIn('KD_UNIT_OR', $seksi) ->orderBy('NM_AR')->get()->getResult(); return json_encode($data); } public function zpzp() { $db = \Config\Database::connect(); $kpp = $this->request->getGet('kpp'); $seksi = $this->request->getGet('seksi'); $ar = $this->request->getGet('ar'); $data = $db->table('KPDL_ZP_NAS_DIFF') ->select("OGC_FID as value, NO_URUT || '-' || ATTRIBUTE1 as label") ->distinct() ->whereIn('KD_KPP', $kpp) ->whereIn('KD_UNIT_OR', $seksi) ->whereIn('NIP_AR', $ar) ->orderBy('LABEL')->get()->getResult(); foreach ($data as $key => $value) { $value->label = $value->LABEL; unset($value->LABEL); } return json_encode(($data)); } public function change_case($arr) { return array_change_key_case($arr, CASE_LOWER); } }