Advertisement
tiaras

Untitled

Oct 14th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.99 KB | None | 0 0
  1. <?php
  2.  
  3. defined('BASEPATH') OR exit('No direct script access allowed');
  4.  
  5. // This can be removed if you use __autoload() in config.php OR use Modular Extensions
  6. /** @noinspection PhpIncludeInspection */
  7. require APPPATH . 'libraries/REST_Controller.php';
  8.  
  9. /**
  10.  * This is an example of a few basic user interaction methods you could use
  11.  * all done with a hardcoded array
  12.  *
  13.  * @package         CodeIgniter
  14.  * @subpackage      Rest Server
  15.  * @category        Controller
  16.  * @author          Phil Sturgeon, Chris Kacerguis
  17.  * @license         MIT
  18.  * @link            https://github.com/chriskacerguis/codeigniter-restserver
  19.  */
  20. class Pembayaran extends REST_Controller {
  21.  
  22.     function __construct()
  23.     {
  24.         // Construct the parent class
  25.         parent::__construct();
  26.  
  27.         // Configure limits on our controller methods
  28.         // Ensure you have created the 'limits' table and enabled 'limits' within application/config/rest.php
  29.     }
  30.  
  31.  
  32.     public function pembayaran_get()
  33.     {
  34.         $this->load->model('M_pembayaran_api');
  35.  
  36.         $data_pembayaran = $this->M_pembayaran_api->get_pembayaran();
  37.         if ($data_pembayaran!= false) {
  38.             $status = 'sukses';
  39.         }else{
  40.             $status = 'gagal';
  41.         }
  42.         $result = array(
  43.             'status' => $status ,
  44.             'data'  => $data_pembayaran );
  45.  
  46.         $this->set_response($result, REST_Controller::HTTP_CREATED); // CREATED (201) being the HTTP response code
  47.     }
  48.  
  49.     public function tagihan_get()
  50.     {
  51.         $this->load->model('M_pembayaran_api');
  52.  
  53.         $data_tagihan = $this->M_pembayaran_api->get_tagihan();
  54.         if ($data_pembayaran!= false) {
  55.             $status = 'sukses';
  56.         }else{
  57.             $status = 'gagal';
  58.         }
  59.         $result = array(
  60.             'status' => $status ,
  61.             'data'  => $data_tagihan );
  62.  
  63.         $this->set_response($result, REST_Controller::HTTP_CREATED); // CREATED (201) being the HTTP response code
  64.     }
  65.  
  66.    
  67.  
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement