original_string: public function loadCount($relations)
      {
          if ($this->isEmpty()) {
              return $this;
          }
  
          $models = $this->first()->newModelQuery()
              ->whereKey($this->modelKeys())
              ->select($this->first()->getKeyName())
              ->withCount(...func_get_args())
              ->get();
  
          $attributes = Arr::except(
              array_keys($models->first()->getAttributes()),
              $models->first()->getKeyName()
          );
  
          $models->each(function ($model) use ($attributes) {
              $this->find($model->getKey())->forceFill(
                  Arr::only($model->getAttributes(), $attributes)
              )->syncOriginalAttributes($attributes);
          });
  
          return $this;
      }
code: public function loadCount($relations)
      {
          if ($this->isEmpty()) {
              return $this;
          }
  
          $models = $this->first()->newModelQuery()
              ->whereKey($this->modelKeys())
              ->select($this->first()->getKeyName())
              ->withCount(...func_get_args())
              ->get();
  
          $attributes = Arr::except(
              array_keys($models->first()->getAttributes()),
              $models->first()->getKeyName()
          );
  
          $models->each(function ($model) use ($attributes) {
              $this->find($model->getKey())->forceFill(
                  Arr::only($model->getAttributes(), $attributes)
              )->syncOriginalAttributes($attributes);
          });
  
          return $this;
      }
code_tokens: public function loadCount ( $ relations ) { if ( $ this -> isEmpty ( ) ) { return $ this ; } $ models = $ this -> first ( ) -> newModelQuery ( ) -> whereKey ( $ this -> modelKeys ( ) ) -> select ( $ this -> first ( ) -> getKeyName ( ) ) -> withCount ( ... func_get_args ( ) ) -> get ( ) ; $ attributes = Arr :: except ( array_keys ( $ models -> first ( ) -> getAttributes ( ) ) , $ models -> first ( ) -> getKeyName ( ) ) ; $ models -> each ( function ( $ model ) use ( $ attributes ) { $ this -> find ( $ model -> getKey ( ) ) -> forceFill ( Arr :: only ( $ model -> getAttributes ( ) , $ attributes ) ) -> syncOriginalAttributes ( $ attributes ) ; } ) ; return $ this ; }
docstring: Load a set of relationship counts onto the collection.
  
  @param  array|string  $relations
  @return $this
docstring_tokens: Load a set of relationship counts onto the collection .