Advertisement
jamboljack

Desa/Kelurahan Pemohon

Nov 22nd, 2018
420
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.05 KB | None | 0 0
  1. // List Desa/Kelurahan Pemohon
  2.     public function desa_post()
  3.     {
  4.         $username     = trim($this->post('username'));
  5.         $kecamatan_id = trim($this->post('kecamatan_id'));
  6.  
  7.         if ($username == '') {
  8.             $response = [
  9.                 'resp_error' => true,
  10.                 'resp_msg'   => 'Username kosong.',
  11.             ];
  12.         } elseif ($kecamatan_id == '') {
  13.             $response = [
  14.                 'resp_error' => true,
  15.                 'resp_msg'   => 'Kecamatan harap dipilih.',
  16.             ];
  17.         } else {
  18.             $listDesa = $this->db->get_where('bpmppt_desa', array('kecamatan_id' => $kecamatan_id))->result();
  19.             foreach ($listDesa as $r) {
  20.                 $response[] = array(
  21.                     'resp_error'   => false,
  22.                     'kecamatan_id' => $r->kecamatan_id,
  23.                     'desa_id'      => $r->desa_id,
  24.                     'desa_nama'    => strtoupper(trim($r->desa_nama)),
  25.                 );
  26.             }
  27.         }
  28.  
  29.         $this->response($response, 200);
  30.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement