Advertisement
jamboljack

Update Device Simpel

Dec 21st, 2018
415
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.69 KB | None | 0 0
  1. public function updatedevice_post()
  2.     {
  3.         $username = trim($this->post('username'));
  4.  
  5.         if ($username == '') {
  6.             $response = [
  7.                 'resp_error' => true,
  8.                 'resp_msg'   => 'Username Kosong.',
  9.             ];
  10.         } else {
  11.             $data = array(
  12.                 'device_id' => trim($this->post('tokenDevice')),
  13.             );
  14.  
  15.             $this->db->where('user_username', $username);
  16.             $this->db->update('lemlit_users', $data);
  17.  
  18.             $response = [
  19.                 'resp_error' => false,
  20.                 'resp_msg'   => 'Device ID Updated.',
  21.             ];
  22.         }
  23.  
  24.         $this->response($response, 200);
  25.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement