Advertisement
jamboljack

Jumlah Notifikasi Anggota

Jan 23rd, 2019
396
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.17 KB | None | 0 0
  1. public function jumlahnotifanggota_post()
  2.     {
  3.         $username = trim($this->post('username'));
  4.         $level    = trim($this->post('level'));
  5.  
  6.         if ($username == '') {
  7.             $response = [
  8.                 'resp_error' => true,
  9.                 'resp_msg'   => 'Username tidak ditemukan.',
  10.             ];
  11.         } elseif ($level == '') {
  12.             $response = [
  13.                 'resp_error' => true,
  14.                 'resp_msg'   => 'Level tidak ditemukan.',
  15.             ];
  16.         } else {
  17.             if ($level == 'Member') {
  18.                 $this->db->where('user_username', $username);
  19.                 $this->db->where('team_position_status', 'Pending');
  20.                 $this->db->from('v_anggota');
  21.                
  22.                 $total = $this->db->count_all_results();
  23.  
  24.                 $response = [
  25.                     'resp_error' => false,
  26.                     'jumlah'     => $total,
  27.                 ];
  28.             } else {
  29.                 $response = [
  30.                     'resp_error' => false,
  31.                     'jumlah'     => 0,
  32.                 ];
  33.             }
  34.  
  35.         }
  36.  
  37.         $this->response($response, 200);
  38.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement