LMongo\Eloquent\Builder::nestedRelations PHP Method

nestedRelations() protected method

Get the deeply nested relations for a given top-level relation.
protected nestedRelations ( string $relation ) : array
$relation string
return array
    protected function nestedRelations($relation)
    {
        $nested = array();
        // We are basically looking for any relationships that are nested deeper than
        // the given top-level relationship. We will just check for any relations
        // that start with the given top relations and adds them to our arrays.
        foreach ($this->eagerLoad as $name => $constraints) {
            if ($this->isNested($name, $relation)) {
                $nested[substr($name, strlen($relation . '.'))] = $constraints;
            }
        }
        return $nested;
    }