public static function predict($fieldName, $modelPath)
    {
        $patterns = Config::getKeyPatterns();

        if (Helpers::strIs($patterns, $fieldName)) {
            $relationName = camel_case(Helpers::extractModelName($fieldName));
            $model = Helpers::guessModelFullName($fieldName, $modelPath);
            $parameters = [$model, $fieldName];

            return new self('belongsTo', $parameters, $relationName);
        }

        return null;
    }
public static function predict($fieldName, $modelPath)
    {
        $patterns = Config::getKeyPatterns();

        if (Helpers::strIs($patterns, $fieldName)) {
            $relationName = camel_case(Helpers::extractModelName($fieldName));
            $model = Helpers::guessModelFullName($fieldName, $modelPath);
            $parameters = [$model, $fieldName];

            return new self('belongsTo', $parameters, $relationName);
        }

        return null;
    }
public static function predict ( $ fieldName , $ modelPath ) { $ patterns = Config :: getKeyPatterns ( ) ; if ( Helpers :: strIs ( $ patterns , $ fieldName ) ) { $ relationName = camel_case ( Helpers :: extractModelName ( $ fieldName ) ) ; $ model = Helpers :: guessModelFullName ( $ fieldName , $ modelPath ) ; $ parameters = [ $ model , $ fieldName ] ; return new self ( 'belongsTo' , $ parameters , $ relationName ) ; } return null ; }
Get a predictable foreign relation using the given field's name

@param string $fieldName
@param string $modelPath

@return null | ForeignRelationship
Get a predictable foreign relation using the given field s name