Est-ce que la relation entre les deux modèles est à ignorer ?

@param  Model  $fromModel
@param  Model  $toModel
@param  string $foreignKey
@param  bool   $isBelongsTo
@return bool
778208
protected function isIgnoredRelation(Model $fromModel, Model $toModel, $foreignKey, $isBelongsTo = false)
    {
        $ignoredRelations = $this->getConfig('ignored_relations', []);

        $from = $fromModel->getTable().( $isBelongsTo ? '.'.$foreignKey : '');
        $to = $toModel->getTable().( !$isBelongsTo ? '.'.$foreignKey : '');

        if (in_array("$from:$to", $ignoredRelations)) {
            return true;
        }

        return false;
    }
473491
public function addModifiedFk($fkName, ForeignKey $fromFk, ForeignKey $toFk)
    {
        $this->modifiedFks[$fkName] = [ $fromFk, $toFk ];
    }
307559
public function hasOne(string $related, string $primary_key = '', string $foreign_key = '')
    {
        $relatedModel = app()->make($related);
        $local_key = $local_key ?? $this->getKey();
        // Make the table name singular and append ID to it
        // FIXME: Use a more reliable approach
        $foreign_key = $foreign_key ?? rtrim($relatedModel->getTable(), 's').'_id';
        return new HasOne($relatedModel, $this, $primary_key, $foreign_key);
    }
663830
public function isForeignKeyIgnored($foreignKey)
    {
        // do not create entities for many2many tables
        if ($this->getConfig()->get(FormatterInterface::CFG_SKIP_M2M_TABLES) && $foreignKey->getReferencedTable()->isManyToMany()) {
            return true;
        }

        return false;
    }
1167583
protected function saveShare($fromOrgId, $fromRespId, $toOrgId, $toPatientId)
    {
        $model = $this->getModel();
        try {
            $result = $model->copyToOrg($fromOrgId, $fromRespId, $toOrgId, $toPatientId, $this->keepConsent);
        } catch (\Exception $exc) {
            // Maybe we could do something with the error...
            $this->addMessage($exc->getMessage());
            return 0;
        }

        return $model->getChanged();
    }
259098
public function hasManyThroughSeveral(array $relations, $foreignKey = null, $localKey = null)
    {
        $helpers = new Helpers($this);
        $currentRelation = current($relations);
        $related = $helpers->getClassNameFromCurrent($currentRelation, $relations);
        $firstRelation = new $related();

        $instance = $this->newRelatedInstance($related);
        $query = $instance
            ->newQuery()
            ->distinct()
            ->select($firstRelation->getTable().'.*');

        $joins = $helpers->getReverseJoinsRelations($relations, $localKey);
        foreach ($joins as $join) {
            $query->join($join['table'], $join['key'], '=', $join['foreign_key']);
        }

        $query->addSelect($join['select_key']);

        $key = $localKey ?? $this->getTable().'.'.$this->getKeyName();
        $value = $this->{$this->getKeyName()};

        $foreignKey = $foreignKey ?? $join['foreign_key'];

        $localKey = $localKey ?? $this->getKeyName();

        $query->where($key, $value);

        return new HasMany($query, $this, $foreignKey, $localKey);
    }
743181
public function belongsTo($related, $foreignKey = '')
    {
        if (!$foreignKey && $related instanceof Model) {
            $column = $related->getTable();
        } else {
            $column = $foreignKey;
        }

        if (empty($related)) {
            unset($this->bean->$column);
        } elseif ($related instanceof Model) {
            $this->bean->$column = $related->getBean();
        } else {
            $this->bean->$column = $related;
        }
    }
941939
public function belongsToMany(Model $relatedModel, $pivotTable, $foreignKey, $otherKey)
    {
        if ($relatedModel->isIgnored()) {
            return;
        }

        $this->relations->add(
            new Relations\BelongsToMany($this, $relatedModel, $pivotTable, $foreignKey, $otherKey)
        );
    }
1295971
protected function associateBelongsTo(array &$formatters, BelongsTo $relation, $seeding) {
        $relatedClass = get_class($relation->getRelated());
        $foreignKey = $relation->{$this->getBelongsToForeignKeyNameMethod()}();

        // Skips dynamic relationships.
        if (!isset($this->columns[$foreignKey])) {
            return;
        }

        $alwaysAssociate = $this->columns[$foreignKey]->getNotnull() || !$seeding;

        $formatters[$foreignKey] = function ($model, $insertedPKs) use ($relatedClass, $alwaysAssociate) {
            if (!isset($insertedPKs[$relatedClass])) {
                return null;
            }

            if ($alwaysAssociate) {
                return $this->generator->randomElement($insertedPKs[$relatedClass]);
            }

            return $this->generator->optional()->randomElement($insertedPKs[$relatedClass]);
        };
    }
548815
public function hasManyDeep($related, array $through, array $foreignKeys = [], array $localKeys = [])
    {
        return $this->newHasManyDeep(...$this->hasOneOrManyDeep($related, $through, $foreignKeys, $localKeys));
    }
1374280
public function on($foreignKey, $key = null) {
        if (is_array($foreignKey)) {
            $this->_conditions = array_replace($this->_conditions, $foreignKey);
        } else {
            $this->_conditions[$foreignKey] = $key;
        }

        return $this;
    }
190298
private function foreignColumnImpl(
        string $localKey,
        string $foreignTable,
        string $foreignKey,
        string $type,
        ?int $length,
        bool $notNullable,
        bool $cascadeDelete
    ): Closure {
        return function (Table $table) use (
            $localKey,
            $foreignTable,
            $foreignKey,
            $notNullable,
            $cascadeDelete,
            $type,
            $length
        ) {
            $options = $cascadeDelete === true ? ['onDelete' => 'CASCADE'] : [];
            $column  = $table->addColumn($localKey, $type)->setNotnull($notNullable);
            $length === null ? $column->setUnsigned(true) : $column->setLength($length);
            $table->addForeignKeyConstraint($foreignTable, [$localKey], [$foreignKey], $options);
        };
    }
433446
public function linkModels(Models $models, Models $foreign, Closure $yield)
    {
        foreach ($models as $model) {

            $linked = [];

            foreach ($foreign as $foreignModel) {
                if ($this->areLinked($model, $foreignModel)) {
                    $linked []= $foreignModel;
                }
            }

            $link = $this->newLinkFrom($model, $linked);

            $yield($link);
        }
    }
167001
public function belongsToMany($related, $table = null, $foreignKey = null, $relatedKey = null, $relation = null)
    {
        // If no relationship name was passed, we will pull backtraces to get the
        // name of the calling function. We will use that function name as the
        // title of this relation since that is a great convention to apply.
        if (is_null($relation)) {
            $relation = $this->guessBelongsToManyRelation();
        }

        // First, we'll need to determine the foreign key and "other key" for the
        // relationship. Once we have determined the keys we'll make the query
        // instances as well as the relationship instances we need for this.
        $instance = $this->newRelatedInstance($related);

        $foreignKey = $foreignKey ?: $this->getForeignKey();

        $relatedKey = $relatedKey ?: $instance->getForeignKey();

        // If no table name was provided, we can guess it by concatenating the two
        // models using underscores in alphabetical order. The two model names
        // are transformed to snake case from their default CamelCase also.
        if (is_null($table)) {
            $table = $this->joiningTable($related);
        }

        return new BelongsToMany(
            $instance->newQuery(), $this, $table, $foreignKey, $relatedKey, $relation
        );
    }
40353
public function belongsTo( $related, $foreignKey = null, $otherKey = null, $relation = null )
	{
		// If no relation name was given, we will use this debug backtrace to extract
		// the calling method's name and use that as the relationship name as most
		// of the time this will be what we desire to use for the relationships.
		if ( is_null( $relation ) )
		{
			list( $current, $caller ) = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 2 );

			$relation = $caller['function'];
		}

		// If no foreign key was supplied, we can use a backtrace to guess the proper
		// foreign key name by using the name of the relationship function, which
		// when combined with an "_id" should conventionally match the columns.
		if ( is_null( $foreignKey ) )
		{
			$foreignKey = Str::snake( $relation ) . '_id';
		}

		$instance = new $related;

		// Once we have the foreign key names, we'll just create a new Eloquent query
		// for the related models and returns the relationship instance which will
		// actually be responsible for retrieving and hydrating every relations.
		$query = $instance->newQuery();

		$otherKey = $otherKey ?: $instance->getKeyName();

		return new BelongsTo( $query, $this, $foreignKey, $otherKey, $relation );
	}
1144137
public function has($name, $foreignKeyOrCallback = null, $callback = null, $storeKey = null)
    {
        $foreignKey = null;
        if (func_num_args() < 4 && is_callable($foreignKeyOrCallback)) {
            $storeKey = $callback;
            $callback = $foreignKeyOrCallback;
        } else {
            $foreignKey = $foreignKeyOrCallback;
        }
        $foreignKey = $foreignKey ? : $this->rows
            ->getTable()
            ->getStructure()
            ->foreignKey($this->getRows()->getTable()->getTableName(), $name);
        $relations = $this->getRows()->loadHasRelations($name, $foreignKey, $callback, $storeKey);
        $this->loadedRelations[] = [
            $storeKey ? : $name, 'has', $foreignKey
        ];
        return $relations->group($foreignKey, $this->getId());
    }
950226
CompositeManyToOne buildCompositeManyToOneOneToMany(Entity entity, final List<Attribute> fromAttributes, ForeignKey fk) {
        Entity targetEntity = getTargetEntity(fk.getImportedKey(), fromAttributes.get(0).getColumnConfig());
        List<Attribute> targetAttributes = getTargetAttributes(fk, targetEntity);

        // composite MANY TO ONE + ONE TO MANY
        Namer targetNamer = relationUtil.getManyToOneNamer(fromAttributes.get(0), targetEntity.getModel());
        Namer inverseNamer = relationUtil.getOneToManyNamer(fromAttributes.get(0).getColumnConfig(), entity.getModel());

        CompositeManyToOne m2o = new CompositeManyToOne(inverseNamer, targetNamer, fromAttributes, entity, targetEntity, targetAttributes) {
            @Override
            protected AbstractRelation buildInverse() {
                CompositeOneToMany co2m2 = new CompositeOneToMany(getTo(), getFrom(), getToAttributes(), getToEntity(), getFromEntity(), getFromAttributes());
                OneToManyConfig o2mConfig = fromAttributes.get(0).getColumnConfig().getOneToManyConfig();
                setLabelPlural(o2mConfig, co2m2);
                initDisplayOrderAsString(o2mConfig, co2m2);
                configureActions(co2m2, cfg().getDefaultOneToManyConfig(), o2mConfig);
                return co2m2;
            }
        };

        ManyToOneConfig m2oConfig = fromAttributes.get(0).getColumnConfig().getManyToOneConfig();
        setLabelSingular(m2oConfig, m2o);
        configureActions(m2o, cfg().getDefaultManyToOneConfig(), m2oConfig);
        return m2o;
    }