Advertisement
Guest User

Controller

a guest
Jul 16th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.09 KB | None | 0 0
  1. public function dataunitkerja()
  2.     {
  3.         $dataunitkerja = $this->unit_kerja_m->get_all();
  4.         $no            = 1;
  5.         foreach ($dataunitkerja as $duk) {
  6.             $tbody   = array();
  7.             $tbody[] = $no++;
  8.             $tbody[] = $duk['E1Kode'];
  9.             $tbody[] = $duk['E2Kode'];
  10.             $tbody[] = $duk['E2Nama'];
  11.             $tbody[] = $duk['EStatus'];
  12.             $aksi= "<button class='btn btn-sm btn-success ubah-data' data-toggle='modal' data-Id=".$duk['Id']."><i class='fas fa-edit'></i></button>".' '."<button class='btn btn-danger btn-sm hapus' id='Id' data-toggle='modal' data-Id=".$duk['Id']."><i class='fas fa-trash-alt'></i></button>";
  13.             $tbody[] = $aksi;
  14.             $data[]  = $tbody;
  15.         }
  16.         if ($dataunitkerja) {
  17.             echo json_encode(array('data' => $data));
  18.         }else{
  19.             echo json_encode(array('data' => 0));
  20.         }
  21.  
  22.     }
  23.  
  24. public function hapusunitkerja()
  25.     {
  26.         $Id = $this->input->post('Id');
  27.         $data = $this->unit_kerja_m->hapusunitkerja($Id);
  28.         echo json_encode($data);
  29.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement