public function with($relation)
    {
        foreach ((array) $relation as $node) {
            $instance = $this->factory->build($this->model(), $node);
            $this->relations[$instance->name()] = $instance;
        }

        return $this;
    }
public function with($relation)
    {
        foreach ((array) $relation as $node) {
            $instance = $this->factory->build($this->model(), $node);
            $this->relations[$instance->name()] = $instance;
        }

        return $this;
    }
public function with ( $ relation ) { foreach ( ( array ) $ relation as $ node ) { $ instance = $ this -> factory -> build ( $ this -> model ( ) , $ node ) ; $ this -> relations [ $ instance -> name ( ) ] = $ instance ; } return $ this ; }
Adds relation to query

@param string|array $relation

@return $this
@throws QueryException
Adds relation to query