protected function getRealtion($foreignTableName, $foreignColumn, $localColumn, $selfReferences)
    {
        $modelName = $this->getModelName($foreignTableName);
        $model = Helpers::guessModelFullName($modelName, Helpers::getModelsPath());

        $params = [
            $model,
            $foreignColumn,
            $localColumn,
        ];

        $relationName = ($selfReferences ? 'child_' : '');

        if ($this->isOneToMany($foreignTableName, $foreignColumn)) {
            return new ForeignRelationship('hasMany', $params, camel_case($relationName . Str::plural($foreignTableName)));
        }

        return new ForeignRelationship('hasOne', $params, camel_case($relationName . Str::singular($foreignTableName)));
    }
protected function getRealtion($foreignTableName, $foreignColumn, $localColumn, $selfReferences)
    {
        $modelName = $this->getModelName($foreignTableName);
        $model = Helpers::guessModelFullName($modelName, Helpers::getModelsPath());

        $params = [
            $model,
            $foreignColumn,
            $localColumn,
        ];

        $relationName = ($selfReferences ? 'child_' : '');

        if ($this->isOneToMany($foreignTableName, $foreignColumn)) {
            return new ForeignRelationship('hasMany', $params, camel_case($relationName . Str::plural($foreignTableName)));
        }

        return new ForeignRelationship('hasOne', $params, camel_case($relationName . Str::singular($foreignTableName)));
    }
protected function getRealtion ( $ foreignTableName , $ foreignColumn , $ localColumn , $ selfReferences ) { $ modelName = $ this -> getModelName ( $ foreignTableName ) ; $ model = Helpers :: guessModelFullName ( $ modelName , Helpers :: getModelsPath ( ) ) ; $ params = [ $ model , $ foreignColumn , $ localColumn , ] ; $ relationName = ( $ selfReferences ? 'child_' : '' ) ; if ( $ this -> isOneToMany ( $ foreignTableName , $ foreignColumn ) ) { return new ForeignRelationship ( 'hasMany' , $ params , camel_case ( $ relationName . Str :: plural ( $ foreignTableName ) ) ) ; } return new ForeignRelationship ( 'hasOne' , $ params , camel_case ( $ relationName . Str :: singular ( $ foreignTableName ) ) ) ; }
Get a corresponding relation to a given table name, foreign column and local column.

@return CrestApps\CodeGenerator\Models\ForeignRelationship
Get a corresponding relation to a given table name foreign column and local column .