Exemplo n.º 1
0
 /**
  * Handles POST action
  *
  * @return \DreamFactory\Core\Utility\ServiceResponse
  * @throws BadRequestException
  * @throws \Exception
  */
 protected function handlePOST()
 {
     if (empty($this->resource)) {
         return false;
     }
     $record = $this->getPayloadData();
     if (empty($record)) {
         throw new BadRequestException('No record detected in request.');
     }
     $record['affects_process'] = static::affectsProcess($this->resource);
     if (EventScript::whereName($this->resource)->exists()) {
         $result = EventScript::updateById($this->resource, $record, $this->request->getParameters());
     } else {
         $result = EventScript::createById($this->resource, $record, $this->request->getParameters());
     }
     return $result;
 }