/** * @param RelationshipField $field * @param ContextContract $context * @return bool */ private function shouldExpand(RelationshipField $field, Context $context) { return $field->shouldExpand($context, $this->currentPath); }
/** * @param ResourceTransformer $transformer * @param RelationshipField $field * @param Context $context * @return Context */ private function getInputChildContext(ResourceTransformer $transformer, RelationshipField $field, Context $context) { $childResourceDefinition = $field->getChildResource(); // Check if we want to create a new child or edit an existing child if ($context->getAction() !== Action::CREATE && $field->canCreateNewChildren() && $this->hasInputIdentifier($transformer, $childResourceDefinition, $context, $input)) { $action = Action::EDIT; } else { $action = Action::CREATE; } $childContext = $context->getChildContext($field, $action); return $childContext; }