Advertisement
jamboljack

List Notifikasi Member

Sep 9th, 2018
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.40 KB | None | 0 0
  1. public function listnotifikasimember_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.             $listNotifikasi = $this->db->get_where('bpmppt_notifikasi', array('user_tujuan' => $username))->result();
  12.             if (count($listNotifikasi) > 0) {
  13.                 foreach ($listNotifikasi as $r) {
  14.                     $response['items'][] = [
  15.                         'resp_error'             => false,
  16.                         'notifikasi_id'          => $r->notifikasi_id,
  17.                         'notifikasi_no_register' => trim($r->notifikasi_no_register),
  18.                         'notifikasi_date'        => date('d-m-Y', strtotime($r->notifikasi_date)),
  19.                         'notifikasi_level'       => trim($r->notifikasi_level),
  20.                         'notifikasi_desc'        => trim($r->notifikasi_desc),
  21.                         'notifikasi_status'      => ($r->notifikasi_status == 1 ? 'Unread' : 'Read'),
  22.                     ];
  23.                 }
  24.             } else {
  25.                 $response = [
  26.                     'resp_error' => false,
  27.                     'resp_msg'   => 'Tidak Ada Notifikasi.',
  28.                 ];
  29.             }
  30.         }
  31.         $this->response($response, 200);
  32.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement