protected function do_nested_eager_load( Collection $loaded, $relation, $nested ) {

		$model = $loaded->first();

		foreach ( $nested as $value => $ignore ) {
			if ( is_string( $value ) ) {
				if ( $model instanceof Model ) {
					$model->get_relation( $value )->eager_load( $loaded->toArray() );
				}

				return;
			} else {
				if ( ! $model instanceof Model ) {
					return;
				}

				$loaded = $model->get_relation( $relation )->eager_load( $loaded->toArray() );

				$this->do_nested_eager_load( $loaded, $nested, $value );
			}
		}
	}
protected function do_nested_eager_load( Collection $loaded, $relation, $nested ) {

		$model = $loaded->first();

		foreach ( $nested as $value => $ignore ) {
			if ( is_string( $value ) ) {
				if ( $model instanceof Model ) {
					$model->get_relation( $value )->eager_load( $loaded->toArray() );
				}

				return;
			} else {
				if ( ! $model instanceof Model ) {
					return;
				}

				$loaded = $model->get_relation( $relation )->eager_load( $loaded->toArray() );

				$this->do_nested_eager_load( $loaded, $nested, $value );
			}
		}
	}
protected function do_nested_eager_load ( Collection $ loaded , $ relation , $ nested ) { $ model = $ loaded -> first ( ) ; foreach ( $ nested as $ value => $ ignore ) { if ( is_string ( $ value ) ) { if ( $ model instanceof Model ) { $ model -> get_relation ( $ value ) -> eager_load ( $ loaded -> toArray ( ) ) ; } return ; } else { if ( ! $ model instanceof Model ) { return ; } $ loaded = $ model -> get_relation ( $ relation ) -> eager_load ( $ loaded -> toArray ( ) ) ; $ this -> do_nested_eager_load ( $ loaded , $ nested , $ value ) ; } } }
Handle a nested eager loaded.

@since 2.0

@param Collection $loaded
@param string     $relation
@param array      $nested
Handle a nested eager loaded .