Example #1
0
 public static function createForCurrentRequest($page = false, $db = false, $options = [])
 {
     $controller = parent::createForCurrentRequest($page, $db, $options);
     $json = file_get_contents('php://input');
     if ($json == '') {
         $controller->apiParams = (object) [];
     } else {
         $controller->apiParams = json_decode($json);
     }
     if (!$controller->apiParams) {
         $controller->errorResponse("Invalid JSON in POST data.");
     }
     return $controller;
 }