Advertisement
jamboljack

List Unread Member

Sep 9th, 2018
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.91 KB | None | 0 0
  1. public function listunreadmember_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.             $this->db->where('user_tujuan', $username);
  12.             $this->db->where('notifikasi_status', 1);
  13.             $this->db->from('bpmppt_notifikasi');
  14.             $total = $this->db->count_all_results();
  15.  
  16.             if ($total > 0) {
  17.                 $response = [
  18.                     'resp_error' => false,
  19.                     'jumlah'     => $total,
  20.                 ];
  21.             } else {
  22.                 $response = [
  23.                     'resp_error' => false,
  24.                     'resp_msg'   => 'Tidak Ada Data Notifikasi.',
  25.                 ];
  26.             }
  27.         }
  28.  
  29.         $this->response($response, 200);
  30.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement