diff --git a/src/AmoCRM/Models/Unsorted/BaseUnsortedModel.php b/src/AmoCRM/Models/Unsorted/BaseUnsortedModel.php index d407200c..07891a97 100644 --- a/src/AmoCRM/Models/Unsorted/BaseUnsortedModel.php +++ b/src/AmoCRM/Models/Unsorted/BaseUnsortedModel.php @@ -362,6 +362,10 @@ public function toArray(): array $result['lead'] = $this->getLead()->toArray(); } + if (!is_null($this->getLead())) { + $result['leads'] = [$this->getLead()->toArray()]; + } + if (!is_null($this->getCompanies())) { $result['companies'] = $this->getCompanies()->toArray(); } @@ -408,7 +412,7 @@ public function toApi(?string $requestId = "0"): array $requestId = $this->getRequestId(); if (!is_null($this->getLead())) { - $result[AmoCRMApiRequest::EMBEDDED]['lead'] = $this->getLead()->toApi($requestId); + $result[AmoCRMApiRequest::EMBEDDED]['leads'] = [$this->getLead()->toApi($requestId)]; } if (!is_null($this->getCompanies())) {