Skip to content

Commit

Permalink
Merge pull request #431 from makeroi/patch-6
Browse files Browse the repository at this point in the history
Update LeadModel.php
  • Loading branch information
bessudnov authored Jan 17, 2022
2 parents 52d2cee + 0bae66b commit 8115e57
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/AmoCRM/Models/LeadModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use AmoCRM\Models\Traits\GetLinkTrait;
use AmoCRM\Models\Traits\RequestIdTrait;
use AmoCRM\Models\Unsorted\Interfaces\UnsortedMetadataInterface;
use AmoCRM\Models\ContactModel;

use function is_null;

Expand Down Expand Up @@ -627,6 +628,17 @@ public function getContacts(): ?ContactsCollection
return $this->contacts;
}

/**
* @return ContactModel|null
*/
public function getMainContact(): ?ContactModel
{
if ($this->contacts) {
return $this->contacts->getBy('isMain', true);
}
return null;
}

/**
* @param null|ContactsCollection $contacts
*
Expand Down

0 comments on commit 8115e57

Please sign in to comment.