public function with( $relations, $callback = null ) {

		$default = null;

		if ( is_string( $relations ) ) {
			$relations = func_get_args();

			if ( func_num_args() === 2 && $relations[1] instanceof Closure ) {
				$relations = array(
					$relations[0] => $relations[1],
				);
			}
		}

		$parsed = array();

		foreach ( $relations as $relation => $callback ) {

			if ( ! $callback instanceof Closure ) {
				$relation = $callback;
				$callback = $default;
			}

			if ( strpos( $relation, '.' ) !== false ) {
				$parsed = $this->parse_nested_with( $relation, $parsed );
			} else {
				$parsed[ $relation ] = $callback;
			}
		}

		$this->relations = $parsed;

		return $this;
	}
public function with( $relations, $callback = null ) {

		$default = null;

		if ( is_string( $relations ) ) {
			$relations = func_get_args();

			if ( func_num_args() === 2 && $relations[1] instanceof Closure ) {
				$relations = array(
					$relations[0] => $relations[1],
				);
			}
		}

		$parsed = array();

		foreach ( $relations as $relation => $callback ) {

			if ( ! $callback instanceof Closure ) {
				$relation = $callback;
				$callback = $default;
			}

			if ( strpos( $relation, '.' ) !== false ) {
				$parsed = $this->parse_nested_with( $relation, $parsed );
			} else {
				$parsed[ $relation ] = $callback;
			}
		}

		$this->relations = $parsed;

		return $this;
	}
public function with ( $ relations , $ callback = null ) { $ default = null ; if ( is_string ( $ relations ) ) { $ relations = func_get_args ( ) ; if ( func_num_args ( ) === 2 && $ relations [ 1 ] instanceof Closure ) { $ relations = array ( $ relations [ 0 ] => $ relations [ 1 ] , ) ; } } $ parsed = array ( ) ; foreach ( $ relations as $ relation => $ callback ) { if ( ! $ callback instanceof Closure ) { $ relation = $ callback ; $ callback = $ default ; } if ( strpos ( $ relation , '.' ) !== false ) { $ parsed = $ this -> parse_nested_with ( $ relation , $ parsed ) ; } else { $ parsed [ $ relation ] = $ callback ; } } $ this -> relations = $ parsed ; return $ this ; }
Perform this query while loading a set of relations.

@param string|array $relations,... An array of relations to Closure callbacks
@param Closure      $callback      The callback for the relation. Called with a FluentQuery object to allow for
customizing which models are eager loaded.

@return $this
Perform this query while loading a set of relations .