protected function getRelationNameFromRelationInstance(Relation $relation)
    {
        // Get all relations, load instances and compare them loosely
        foreach ($this->info->relations as $relationData) {

            if ($relation == $this->model()->{$relationData->method}()) {
                return $relationData->method;
            }
        }

        // @codeCoverageIgnoreStart
        return null;
        // @codeCoverageIgnoreEnd
    }
protected function getRelationNameFromRelationInstance(Relation $relation)
    {
        // Get all relations, load instances and compare them loosely
        foreach ($this->info->relations as $relationData) {

            if ($relation == $this->model()->{$relationData->method}()) {
                return $relationData->method;
            }
        }

        // @codeCoverageIgnoreStart
        return null;
        // @codeCoverageIgnoreEnd
    }
protected function getRelationNameFromRelationInstance ( Relation $ relation ) { // Get all relations, load instances and compare them loosely foreach ( $ this -> info -> relations as $ relationData ) { if ( $ relation == $ this -> model ( ) -> { $ relationData -> method } ( ) ) { return $ relationData -> method ; } } // @codeCoverageIgnoreStart return null ; // @codeCoverageIgnoreEnd }
Returns relation method name related to a relation instance.

@param Relation $relation
@return null|string
Returns relation method name related to a relation instance .