Advertisement
jamboljack

Cek Toko

Dec 2nd, 2019
442
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.01 KB | None | 0 0
  1. // Toko
  2.     public function toko_post()
  3.     {
  4.         $username = trim($this->post('username'));
  5.  
  6.         if ($username == '') {
  7.             $response = [
  8.                 'resp_error' => true,
  9.                 'resp_msg'   => 'Username tidak ditemukan.',
  10.             ];
  11.  
  12.             $this->response($response, 403);
  13.         } else {
  14.             $checkToko = $this->db->get_where('simastani_toko', array('user_username' => $username))->row();
  15.             if (count($checkToko) == 0) {
  16.                 $response = [
  17.                     'resp_error' => false,
  18.                     'resp_msg'   => 'kosong',
  19.                     'toko_id'    => '',
  20.                 ];
  21.  
  22.                 $this->response($response, 200);
  23.             } else {
  24.                 $response = [
  25.                     'resp_error' => false,
  26.                     'resp_msg'   => 'success',
  27.                     'toko_id'    => $checkToko->toko_id,
  28.                 ];
  29.  
  30.                 $this->response($response, 200);
  31.             }
  32.         }
  33.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement