code: private function generalAttachment(
          Article $article,
          array $attachmentConst,
          array $attachmentype,
          array $attributes,
          array $dataArticle
      ): Article {
          $numOfAttachments = count($attachmentConst);
  
          for ($i = 0; $i < $numOfAttachments; $i++) {
              $attachments = $this->attachment($attachmentype[$i], $attributes[$i], $dataArticle);
  
              for ($j = 0; $j < $attachments['numberOfItems']; $j++) {
                  $attachment = $attachments['attachments'][$j];
  
                  $article->attach($attachmentConst[$i], $attachment);
              }
          }
  
          return $article;
      }
docs: Attach attachments to article