Advertisement
vdp

Untitled

vdp
Jun 26th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.01 KB | None | 0 0
  1. <?php
  2. defined('BASEPATH') OR exit('No direct script access allowed');
  3. require APPPATH . '/libraries/REST_Controller.php';
  4. class Family extends REST_Controller {
  5.     function __construct($config = 'rest') {
  6.       parent::__construct($config);
  7.       $this->load->database();
  8.       $this->load->model('FamilyModel');
  9.     }
  10.     public function api_delete(){
  11.       $headers = $this->input->request_headers();
  12.       if (array_key_exists('Authorization', $headers) && !empty($headers['Authorization'])) {
  13.           $decodedToken = AUTHORIZATION::validateToken($headers['Authorization']);
  14.           if ($decodedToken != false) {
  15.             $id_user = $this->input->get('id_user');
  16.             $id_user_family = $this->input->get('id_user_family');
  17.             $response = $this->FamilyModel->deleteFamily($id_user,$id_user_family);
  18.             $this->set_response($response, REST_Controller::HTTP_OK);
  19.           }
  20.       }else{
  21.         $this->set_response("Unauthorised", REST_Controller::HTTP_UNAUTHORIZED);
  22.       }
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement