public function expand($relations)
    {
        if (is_string($relations)) {
            $relations = [$relations];
        }
        $relations = Set::normalize($relations);

        foreach ($relations as $path => $value) {
            $num = strpos($path, '.');
            $name = $num !== false ? substr($path, 0, $num) : $path;
            $rel = $this->relation($name);
            if ($rel->type() !== 'hasManyThrough') {
                continue;
            }
            $relPath = $rel->through() . '.' . $rel->using() . ($num !== false ? '.' . substr($path, $num + 1) : '');
            if (!isset($relations[$relPath])) {
                $relations[$relPath] = $relations[$path];
            }
        }
        return $relations;
    }
public function expand($relations)
    {
        if (is_string($relations)) {
            $relations = [$relations];
        }
        $relations = Set::normalize($relations);

        foreach ($relations as $path => $value) {
            $num = strpos($path, '.');
            $name = $num !== false ? substr($path, 0, $num) : $path;
            $rel = $this->relation($name);
            if ($rel->type() !== 'hasManyThrough') {
                continue;
            }
            $relPath = $rel->through() . '.' . $rel->using() . ($num !== false ? '.' . substr($path, $num + 1) : '');
            if (!isset($relations[$relPath])) {
                $relations[$relPath] = $relations[$path];
            }
        }
        return $relations;
    }
public function expand ( $ relations ) { if ( is_string ( $ relations ) ) { $ relations = [ $ relations ] ; } $ relations = Set :: normalize ( $ relations ) ; foreach ( $ relations as $ path => $ value ) { $ num = strpos ( $ path , '.' ) ; $ name = $ num !== false ? substr ( $ path , 0 , $ num ) : $ path ; $ rel = $ this -> relation ( $ name ) ; if ( $ rel -> type ( ) !== 'hasManyThrough' ) { continue ; } $ relPath = $ rel -> through ( ) . '.' . $ rel -> using ( ) . ( $ num !== false ? '.' . substr ( $ path , $ num + 1 ) : '' ) ; if ( ! isset ( $ relations [ $ relPath ] ) ) { $ relations [ $ relPath ] = $ relations [ $ path ] ; } } return $ relations ; }
Expands all `'hasManyThrough'` relations into their full path.

@param  array $relations The relations to eager load.
@return array            The relations with expanded `'hasManyThrough'` relations.
Expands all hasManyThrough relations into their full path .