original_string: protected function loadMissingRelation(self $models, array $path)
      {
          $relation = array_shift($path);
  
          $name = explode(':', key($relation))[0];
  
          if (is_string(reset($relation))) {
              $relation = reset($relation);
          }
  
          $models->filter(function ($model) use ($name) {
              return ! is_null($model) && ! $model->relationLoaded($name);
          })->load($relation);
  
          if (empty($path)) {
              return;
          }
  
          $models = $models->pluck($name);
  
          if ($models->first() instanceof BaseCollection) {
              $models = $models->collapse();
          }
  
          $this->loadMissingRelation(new static($models), $path);
      }
code: protected function loadMissingRelation(self $models, array $path)
      {
          $relation = array_shift($path);
  
          $name = explode(':', key($relation))[0];
  
          if (is_string(reset($relation))) {
              $relation = reset($relation);
          }
  
          $models->filter(function ($model) use ($name) {
              return ! is_null($model) && ! $model->relationLoaded($name);
          })->load($relation);
  
          if (empty($path)) {
              return;
          }
  
          $models = $models->pluck($name);
  
          if ($models->first() instanceof BaseCollection) {
              $models = $models->collapse();
          }
  
          $this->loadMissingRelation(new static($models), $path);
      }
code_tokens: protected function loadMissingRelation ( self $ models , array $ path ) { $ relation = array_shift ( $ path ) ; $ name = explode ( ':' , key ( $ relation ) ) [ 0 ] ; if ( is_string ( reset ( $ relation ) ) ) { $ relation = reset ( $ relation ) ; } $ models -> filter ( function ( $ model ) use ( $ name ) { return ! is_null ( $ model ) && ! $ model -> relationLoaded ( $ name ) ; } ) -> load ( $ relation ) ; if ( empty ( $ path ) ) { return ; } $ models = $ models -> pluck ( $ name ) ; if ( $ models -> first ( ) instanceof BaseCollection ) { $ models = $ models -> collapse ( ) ; } $ this -> loadMissingRelation ( new static ( $ models ) , $ path ) ; }
docstring: Load a relationship path if it is not already eager loaded.
  
  @param  \Illuminate\Database\Eloquent\Collection  $models
  @param  array  $path
  @return void
docstring_tokens: Load a relationship path if it is not already eager loaded .