Example #1
0
 public function log()
 {
     if (false) {
         return true;
     }
     $model = new ApiRequestLogs();
     $dataType = 'Text';
     if (is_array($this->params)) {
         $dataType = 'Array';
     }
     if (isset($_SERVER['REQUEST_URI'])) {
         $requestURI = $_SERVER['REQUEST_URI'];
     } else {
         $requestURI = '';
     }
     $model->method = $_SERVER['REQUEST_METHOD'] . ' - ' . $requestURI;
     if (is_array($this->params)) {
         $model->content = json_encode($this->params);
     } else {
         $model->content = $this->params;
     }
     $model->created_date = date('Y-m-d H:i:s');
     $model->save();
 }