Example::users_delete PHP Method

users_delete() public method

public users_delete ( )
    public function users_delete()
    {
        $id = (int) $this->get('id');
        // Validate the id.
        if ($id <= 0) {
            // Set the response and exit
            $this->response(NULL, REST_Controller::HTTP_BAD_REQUEST);
            // BAD_REQUEST (400) being the HTTP response code
        }
        // $this->some_model->delete_something($id);
        $message = ['id' => $id, 'message' => 'Deleted the resource'];
        $this->set_response($message, REST_Controller::HTTP_NO_CONTENT);
        // NO_CONTENT (204) being the HTTP response code
    }