code: protected function fillRelationships(
          $record,
          Collection $relationships,
          EncodingParametersInterface $parameters
      ) {
          $relationships->filter(function ($value, $field) use ($record) {
              return $this->isFillableRelation($field, $record);
          })->each(function ($value, $field) use ($record, $parameters) {
              $this->fillRelationship($record, $field, $value, $parameters);
          });
      }
docs: Fill relationships from a resource object.
  
  @param $record
  @param Collection $relationships
  @param EncodingParametersInterface $parameters
  @return void