Gets the relationship inputs

@param \Illuminate\Http\Request				$request
@param array									$fields

@return array
975280
protected function getRelationshipInputs(\Illuminate\Http\Request $request, array $fields)
	{
		$inputs = array();

		//run through the edit fields to find the relationships
		foreach ($fields as $name => $field)
		{
			if ($field->getOption('external'))
			{
				$inputs[$name] = $this->formatRelationshipInput($request->get($name, NULL), $field);
			}
		}

		return $inputs;
	}
575182
protected static function getParams(PsrRequest $request)
    {
        $params = (array)$request->getAttribute('params', []);
        $params += [
            'plugin' => null,
            'controller' => null,
            'action' => null,
            '_ext' => null,
            'pass' => []
        ];

        return $params;
    }
483695
protected static function getRequestRelationships($parameters)
    {
        //work with objects
        if (!is_object($parameters) && is_array($parameters)) {
            $parameters = (object) $parameters;
        }

        //Require data
        Request::requireParameters($parameters, ['data']);

        //Require data['relationships']
        if (isset($parameters->data->relationships)) {
            return (object) $parameters->data->relationships;
        } else {
            return new \stdClass();
        }
    }
598188
public function getAll($uuid, Request $request)
    {
        $parentModel = static::$parentModel;
        $parentResource = $parentModel::findOrFail($uuid);

        // Authorize ability to view children models for parent
        $this->authorizeUserAction($this->parentAbilitiesRequired['view'], $parentResource);

        $model = static::$model;
        $resourceRelationName = model_relation_name($model);

        // Form model's with relations for parent query
        $withArray = [];
        foreach ($model::$localWith as $modelRelation) {
            $withArray[] = $resourceRelationName . '.' . $modelRelation;
        }

        $withArray = array_merge([$resourceRelationName], $withArray);

        $parentResource = $parentResource->where($parentResource->getKeyName(), '=', $parentResource->getKey())->with($withArray)->first();

        $collection = $parentResource->getRelationValue($resourceRelationName);

        if ($collection == null) {
            $collection = new Collection();
        }

        return $this->response->collection($collection, $this->getTransformer());
    }
1212401
protected function getRelationCollections(array $fields, $view)
    {
        $variables = [];

        foreach ($fields as $field) {
            if ($field->hasForeignRelation() && $field->isOnView($view)) {
                $variables[] = $field->getForeignRelation();
            }
        }

        return $variables;
    }
574797
private function getRoles($request)
    {
        $routeActions = $this->getActions($request);

        $roles = array_get($routeActions, 'is', []);

        return is_array($roles) ? $roles : (array) $roles;
    }
999552
protected function getUserData(Request $request)
    {
        $data = [];

        foreach ($this->repository->all() as $field) {
            $data[$field->getName()] = $request->get($field->getName());
        }

        return $data;
    }
532336
public function getFieldsAction(Request $request)
    {
        $locale = $this->getProductLocaleManager()->retrieveLocale($this->getUser(), $request->getLocale());

        return $this->handleView(
            $this->view(
                array_values($this->getVariantAttributeManager()->retrieveFieldDescriptors($locale))
            )
        );
    }
866516
protected function fields(array $fields)
    {
        $result = array();
        foreach ($fields as $id => $field) {
            if (!isset($field['id'])) {
                $field['id'] = $id;
            }
            if (!isset($field['name'])) {
                $field['name'] = $id;
            }
            $result[$id] = $this->field($field);
        }
        return $result;
    }
978849
private function getPopulatedRelations($object, ?string $format, array $context, array $relationships): array
    {
        $data = [];

        if (!isset($context['resource_class'])) {
            return $data;
        }

        unset($context['api_included']);
        foreach ($relationships as $relationshipDataArray) {
            $relationshipName = $relationshipDataArray['name'];

            $attributeValue = $this->getAttributeValue($object, $relationshipName, $format, $context);

            if ($this->nameConverter) {
                $relationshipName = $this->nameConverter->normalize($relationshipName, $context['resource_class'], self::FORMAT, $context);
            }

            if (!$attributeValue) {
                continue;
            }

            $data[$relationshipName] = [
                'data' => [],
            ];

            // Many to one relationship
            if ('one' === $relationshipDataArray['cardinality']) {
                unset($attributeValue['data']['attributes']);
                $data[$relationshipName] = $attributeValue;

                continue;
            }

            // Many to many relationship
            foreach ($attributeValue as $attributeValueElement) {
                if (!isset($attributeValueElement['data'])) {
                    throw new UnexpectedValueException(sprintf('The JSON API attribute \'%s\' must contain a "data" key.', $relationshipName));
                }
                unset($attributeValueElement['data']['attributes']);
                $data[$relationshipName]['data'][] = $attributeValueElement['data'];
            }
        }

        return $data;
    }
112806
protected function listAll(Request $request)
    {
        $fields = $request->input('fields') ? explode(',', $request->input('fields')) : ['*'];

        $allResults = $this->repository->all($fields);

        return Response::apiResponse([
            'data' => $allResults
        ]);
    }
1150597
protected static function query($fields)
    {
        $result = Query::from(static::$table);

        $result = $result->where();

        foreach ($fields as $key => $value) {
            $result = $result->andWhere($key, '=', $value);
        }

        return $result->get();
    }
1176907
protected function makeCopyOfRelations(\Illuminate\Http\Request $request)
    {
        $newData = [];
        $data = $request->input($this->relationName, []);

        $counter = 1;
        $newKey = static::NEW_ITEM;

        foreach ($data as $key => $values) {
            $newData["{$newKey}_{$counter}"] = $values;
            $counter++;
        }

        $request->merge([$this->relationName => $newData]);
    }
674093
private function getParentEntityDefinition(Request $request)
    {
        if (!$this->meta->hasParent()) {
            return array_fill(0, 4, null);
        }

        $associationParam = $this->meta->getParent()->getAssociationParameterName();
        $id = (int) $request->query->get($associationParam);

        if (empty($id)) {
            throw $this->createNotFoundException(sprintf('Value of query parameter "%s" must be provided.', $associationParam));
        }

        return [
            $this->getEntity($id, $this->meta->getParent()->getMetadata()->getEntityClass()),
            $this->meta->getParent()->getAssociation(),
            $associationParam,
            $id,
        ];
    }
142230
public function update($request) {
        $this->resolveModel();
        $model = Dir::apiModel($this->model);
        $modelFind = $model::find($request->id);

        if(!empty($request->relationalModel)) {
            $idRelationalModel = trim(strtolower($request->relationalModel), 's');
            $idRelationalModel =  $idRelationalModel.'Id';
            if($modelFind->$idRelationalModel != $request->idRelational) killer('400');
        }

        foreach($modelFind->getTuples() as $tuple)
            if(!empty($request->$tuple))
                $modelFind->$tuple = $request->$tuple;

        $modelFind->update();
        return $modelFind;
    }
353738
protected function getRelationInputs($inputs = [])
    {
        $relations = [];

        foreach ($inputs as $column => $value) {
            if (method_exists($this->model, $column)) {
                $relation = call_user_func([$this->model, $column]);

                if ($relation instanceof Relation) {
                    $relations[$column] = $value;
                }
            }
        }

        return $relations;
    }
18191
private function getMainFields(array $fields): array
    {
        $main = [];
        foreach ($fields as $field) {
            if ($field instanceof ChildrenAssociationField) {
                continue;
            }

            if ($field->is(Deferred::class)) {
                continue;
            }

            if (!$field->is(PrimaryKey::class)) {
                $main[] = $field;
                continue;
            }

            if ($field instanceof FkField) {
                $main[] = $field;
            }
        }

        return $main;
    }