public static function relationFromField($fieldName, $method = null)
    {
        if ($method) return $method;

        if (substr($fieldName, -3) == '_id') {
            return substr($fieldName, 0, -3);
        }

        if (substr($fieldName, -4) == '_ids') {
            return substr($fieldName, 0, -4) . 's';
        }

        return $fieldName;
    }
public static function relationFromField($fieldName, $method = null)
    {
        if ($method) return $method;

        if (substr($fieldName, -3) == '_id') {
            return substr($fieldName, 0, -3);
        }

        if (substr($fieldName, -4) == '_ids') {
            return substr($fieldName, 0, -4) . 's';
        }

        return $fieldName;
    }
public static function relationFromField ( $ fieldName , $ method = null ) { if ( $ method ) return $ method ; if ( substr ( $ fieldName , - 3 ) == '_id' ) { return substr ( $ fieldName , 0 , - 3 ) ; } if ( substr ( $ fieldName , - 4 ) == '_ids' ) { return substr ( $ fieldName , 0 , - 4 ) . 's' ; } return $ fieldName ; }
Consider this as a bit of magic
This method will return a "guessed" method name which is used from the relation
Since there is no way in Eloquent to "read" the relations from a model, we have to work with what we get

This method only does something when no method was set in the dca
It takes one $field of the dca and removes the _id
So 'topic_id' will be 'topic' and 'topic_ids' will be 'topics'.
If no _id is present, it just uses the $fieldName as method name for the relation
Consider this as a bit of magic This method will return a guessed method name which is used from the relation Since there is no way in Eloquent to read the relations from a model we have to work with what we get