error400(); $data = Request::json(); $payload = $data->all(); $summit = SummitFinderStrategyFactory::build($this->getSummitRepository(), $this->getResourceServerContext())->find($summit_id); if (is_null($summit)) return $this->error404(); // Creates a Validator instance and validates the data. $validation = Validator::make($payload, $this->getAddValidationRules($payload)); if ($validation->fails()) { $messages = $validation->messages()->toArray(); return $this->error412 ( $messages ); } $child = $this->addChild($summit, $payload); $fields = Request::input('fields', ''); $relations = Request::input('relations', ''); $relations = !empty($relations) ? explode(',', $relations) : []; $fields = !empty($fields) ? explode(',', $fields) : []; return $this->created(SerializerRegistry::getInstance()->getSerializer ( $child, $this->addSerializerType() )->serialize( Request::input('expand', ''), $fields, $relations )); } catch (ValidationException $ex) { Log::warning($ex); return $this->error412(array($ex->getMessage())); } catch(EntityNotFoundException $ex) { Log::warning($ex); return $this->error404(array('message'=> $ex->getMessage())); } catch (\HTTP401UnauthorizedException $ex) { Log::warning($ex); return $this->error401(); } catch (HTTP403ForbiddenException $ex) { Log::warning($ex); return $this->error403(); } catch (Exception $ex) { Log::error($ex); return $this->error500($ex); } } }