Get an array of the cascading relation names mapped to their relation types.

@return array
19754
public function getCascadeDeletesRelations()
    {
        $names = $this->getCascadeDeletesRelationNames();

        return array_combine($names, array_map(function ($name) {
            $relation = method_exists($this, $name) ? $this->$name() : null;

            return $relation instanceof Relation ? $relation : null;
        }, $names));
    }
916167
private function getRelationships()
    {
        $r = '';

        $relationships = (array)$this->xml->xpath('/draggy/relationships/relation');

        foreach ($relationships as $relation) {
            $relationAttributes = (array)$relation;
            $relationAttributes = $relationAttributes['@attributes'];

            $this->checkMandatoryAttributes('Relationship', $relationAttributes, ['from', 'to', 'type']);

            $r .= 'var l = new Link(\'' . str_replace(
                '\\',
                '\\\\',
                $relationAttributes['from']
            ) . '\',\'' . str_replace(
                '\\',
                '\\\\',
                $relationAttributes['to']
            ) . '\',\'' . $relationAttributes['type'] . '\',' . ( isset( $relationAttributes['fromAttribute'] ) ? '\'' . $relationAttributes['fromAttribute'] . '\'' : 'undefined' ) . ', ' . ( isset( $relationAttributes['toAttribute'] ) ? '\'' . $relationAttributes['toAttribute'] . '\'' : 'undefined' ) . ')' . PHP_EOL;

            if (isset( $relationAttributes['broken'] )) {
                $r .= 'l.setBroken(' . $relationAttributes['broken'] . ');' . PHP_EOL;
            }

            if (isset( $relationAttributes['persist'] )) {
                if ('true' === $relationAttributes['persist']) { // Backwards compatibility
                    $relationAttributes['persist'] = 'both';
                }

                $r .= 'l.setPersist("' . $relationAttributes['persist'] . '");' . PHP_EOL;
            } else { // Backwards compatibility
                $r .= 'l.setPersist(true);' . PHP_EOL;
            }

            if (isset( $relationAttributes['remove'] )) {
                if ('true' === $relationAttributes['remove']) { // Backwards compatibility
                    $relationAttributes['remove'] = 'both';
                }
                $r .= 'l.setRemove("' . $relationAttributes['remove'] . '");' . PHP_EOL;
            } else { // Backwards compatibility
                $r .= 'l.setRemove(true);' . PHP_EOL;
            }
        }

        return $r;
    }
1060449
public function relationsToArray()
    {
        $attributes = [];

        foreach ($this->getArrayableRelations() as $key => $value) {
            if ($value instanceof Model) {
                $relation = $value->toArray();
            } elseif (is_array($value)) {
                $relation = $value;
            } elseif (is_null($value)) {
                $relation = $value;
            }

            // If the relationships snake-casing is enabled, we will snake case this
            // key so that the relation attribute is snake cased in this returned
            // array to the developers, making this consistent with attributes.
            if (static::$snakeAttributes) {
                $key = str_snake($key);
            }

            // If the relation value has been set, we will set it on this attributes
            // list for returning. If it was not arrayable or null, we'll not set
            // the value on the array because it is some type of invalid value.
            if (isset($relation) || is_null($value)) {
                $attributes[$key] = $relation;
            }

            unset($relation);
        }

        return $attributes;
    }
153141
protected function nestedRelations(string $relation): array
    {
        $nested = [];

        // We are basically looking for any relationships that are nested deeper than
        // the given top-level relationship. We will just check for any relations
        // that start with the given top relations and adds them to our arrays.
        foreach ($this->eagerLoads as $name => $constraints) {
            if ($this->isNested($name, $relation)) {
                $nested[substr($name, strlen($relation.'.'))] = $constraints;
            }
        }

        return $nested;
    }
835272
public function getRespondentRelationFields() {
        $fields = array();
        $relationFields = $this->getFieldsOfType('relation');

        if (!empty($relationFields)) {
            $fieldNames = $this->getFieldNames();
            $fieldPrefix = FieldMaintenanceModel::FIELDS_NAME . FieldsDefinition::FIELD_KEY_SEPARATOR;
            foreach ($this->getFieldsOfType('relation') as $key => $field)
            {
                $id = str_replace($fieldPrefix, '', $key);
                $fields[$id] = $fieldNames[$key];
            }
        }

        return $fields;
    }
281260
public function getAllRelations()
    {
        if (count($this->allRelations) === 0) {
            $allRelations = array_merge(array_keys($this->relations), array_keys($this->localRelatedFilters));

            foreach ($allRelations as $related) {
                $this->allRelations[$related] = array_merge($this->getLocalRelation($related), $this->getRelatedFilterInput($related));
            }
        }

        return $this->allRelations;
    }
971042
protected function loadRelated(): array
    {
        $innerKey = $this->parent->getField($this->key(Record::INNER_KEY));
        if (empty($innerKey)) {
            return [];
        }

        //Work with pre-build query
        $query = $this->createQuery($innerKey);

        //Use custom node to parse data
        $node = new PivotedRootNode(
            $this->schema[Record::RELATION_COLUMNS],
            $this->schema[Record::PIVOT_COLUMNS],
            $this->schema[Record::OUTER_KEY],
            $this->schema[Record::THOUGHT_INNER_KEY],
            $this->schema[Record::THOUGHT_OUTER_KEY]
        );

        $iterator = $query->getIterator();
        foreach ($iterator as $row) {
            //Time to parse some data
            $node->parseRow(0, $row);
        }

        //Memory free
        $iterator->close();

        return $node->getResult();
    }
652445
protected function getForeignKeyRelations() {
    if ($this->fkRelations == null) {
      $this->fkRelations = [];
      $relationDescs = $this->getRelations();
      foreach($relationDescs as $relationDesc) {
        if ($relationDesc instanceof RDBManyToOneRelationDescription) {
          $this->fkRelations[] = $relationDesc;
        }
      }
    }
    return $this->fkRelations;
  }
777653
public function getQueueableRelations()
    {
        $relations = [];

        foreach ($this->getRelations() as $key => $relation) {
            if (method_exists($this, $key)) {
                $relations[] = $key;
            }

            if ($relation instanceof QueueableCollection) {
                foreach ($relation->getQueueableRelations() as $collectionValue) {
                    $relations[] = $key.'.'.$collectionValue;
                }
            }

            if ($relation instanceof QueueableEntity) {
                foreach ($relation->getQueueableRelations() as $entityKey => $entityValue) {
                    $relations[] = $key.'.'.$entityValue;
                }
            }
        }

        return array_unique($relations);
    }
1321378
public function getPossibleParents() {
    $result = [];
    $relations = $this->getRelations('parent');
    foreach ($relations as $curRelation) {
      $result[$curRelation->getOtherRole()] = $curRelation;
    }
    return $result;
  }
1168775
protected function collectForeignKeys()
    {
        $keys = [];

        foreach ($this->info->relations as $relation) {

            if ( ! in_array(
                $relation->type,
                [ RelationType::BELONGS_TO, RelationType::MORPH_TO, RelationType::BELONGS_TO_THROUGH ]
            )) {
                continue;
            }

            $keys = array_merge($keys, $relation->foreign_keys);
        }

        return $keys;
    }
269896
public function getPossibleChildren() {
    $result = [];
    $relations = $this->getRelations('child');
    foreach ($relations as $curRelation) {
      $result[$curRelation->getOtherRole()] = $curRelation;
    }
    return $result;
  }
1107527
public function getDirtyRelationships(): array
    {
        $dirtyAggregates = [];

        foreach ($this->relationships as $relation) {
            foreach ($relation as $aggregate) {
                if (!$aggregate->exists() || $aggregate->isDirty() || count($aggregate->getDirtyRelationships()) > 0) {
                    $dirtyAggregates[] = $aggregate;
                }
            }
        }

        return $dirtyAggregates;
    }
798873
public function getRelationships(): array
    {
        $relationships = [];
        if ($this->hasTransformer()) {
            if (($transformer = $this->getTransformer()) instanceof TransformerInterface) {
                $relationships = $transformer->getRelationships();
            }
        }

        return $relationships;
    }
274805
public function getRelations()
    {
        $relations = $columns = [];

        /** @var Field $field */
        foreach ($this->builder->fields() as $field) {
            $columns[] = $field->column();
        }

        foreach (Arr::flatten($columns) as $column) {
            if (Str::contains($column, '.')) {
                list($relation) = explode('.', $column);

                if (method_exists($this->model, $relation) &&
                    $this->model->$relation() instanceof Relations\Relation
                ) {
                    $relations[] = $relation;
                }
            } elseif (method_exists($this->model, $column) &&
                !method_exists(Model::class, $column)
            ) {
                $relations[] = $column;
            }
        }

        return array_unique($relations);
    }
1312940
public function getDirtyRelations()
    {
        $dirtyRelations = [];
        foreach ($this->_relations as $relationName) {
            if (array_key_exists($relationName, $this->_oldRelationValue)) {
                $dirtyRelations[$relationName] = $this->owner->{$relationName};
            }
        }
        return $dirtyRelations;
    }
766609
protected function getRelationFields() {
        $fields = [];
        foreach ($this->relations as $relation) {
            $fields = array_merge($fields, $relation->getLinkKeys());
        }
        return array_unique($fields);
    }