Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- defined('BASEPATH') OR exit('No direct script access allowed');
- require APPPATH . '/libraries/REST_Controller.php';
- use Restserver\Libraries\REST_Controller;
- class ApiRegister extends REST_Controller {
- function __construct($config = 'rest') {
- parent::__construct($config);
- $this->load->database();
- }
- function index_post() {
- $data = array(
- 'id_cust' => $this->post('id_cust'),
- 'nama_cust' => $this->post('nama_cust'),
- 'username' => $this->post('username'),
- 'password' => $this->post('password'),
- 'email' => $this->post('email'),
- 'no_hp' => $this->post('no_hp'));
- $insert = $this->db->insert('customer', $data);
- if ($insert) {
- $this->response($data, 200);
- } else {
- $this->response(array('status' => 'fail', 502));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement