protected function getRelations($relations)
    {
        $existingNames = [];
        $finalRelations = [];
        foreach ($relations as $relation) {
            $newRelation = ForeignRelationship::fromString($relation);
            if (is_null($newRelation)) {
                continue;
            }

            if (!empty($newRelation->name) && in_array($newRelation->name, $existingNames)) {
                continue;
            }

            $finalRelations[] = $newRelation;
            $existingNames[] = $newRelation->name;
        }

        return $finalRelations;
    }
protected function getRelations($relations)
    {
        $existingNames = [];
        $finalRelations = [];
        foreach ($relations as $relation) {
            $newRelation = ForeignRelationship::fromString($relation);
            if (is_null($newRelation)) {
                continue;
            }

            if (!empty($newRelation->name) && in_array($newRelation->name, $existingNames)) {
                continue;
            }

            $finalRelations[] = $newRelation;
            $existingNames[] = $newRelation->name;
        }

        return $finalRelations;
    }
protected function getRelations ( $ relations ) { $ existingNames = [ ] ; $ finalRelations = [ ] ; foreach ( $ relations as $ relation ) { $ newRelation = ForeignRelationship :: fromString ( $ relation ) ; if ( is_null ( $ newRelation ) ) { continue ; } if ( ! empty ( $ newRelation -> name ) && in_array ( $ newRelation -> name , $ existingNames ) ) { continue ; } $ finalRelations [ ] = $ newRelation ; $ existingNames [ ] = $ newRelation -> name ; } return $ finalRelations ; }
Get the relations from an existing array.

@param array $relations

@return array
Get the relations from an existing array .