Advertisement
jamboljack

List User FO

Sep 6th, 2018
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.08 KB | None | 0 0
  1. // Daftar Front Office
  2.     public function listuserfrontoffice_post()
  3.     {
  4.         $username = trim($this->post('username'));
  5.  
  6.         if ($username == '') {
  7.             $response = [
  8.                 'resp_error' => true,
  9.                 'resp_msg'   => 'Username Kosong.',
  10.             ];
  11.         } else {
  12.             $listUser = $this->db->get_where('bpmppt_users', array('device_id !=' => '', 'user_level' => 'Front Office'))->result();
  13.             if (count($listUser) > 0) {
  14.                 foreach ($listUser as $r) {
  15.                     $response['items'][] = [
  16.                         'resp_error'    => false,
  17.                         'user_username' => $r->user_username,
  18.                         'user_name'     => $r->user_name,
  19.                         'device_id'     => $r->device_id,
  20.                     ];
  21.                 }
  22.             } else {
  23.                 $response = [
  24.                 'resp_error' => true,
  25.                 'resp_msg'   => 'Device Tidak Ditemukan.',
  26.             ];
  27.             }
  28.         }
  29.  
  30.         $this->response($response, 200);
  31.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement