/** * Get ContactPhone from contact by ContactPhone * * @param Contact $contact * @param ContactPhone $contactPhone * * @return mixed */ protected function getContactPhoneFromContact(Contact $contact, ContactPhone $contactPhone) { $filtered = $contact->getPhones()->filter(function (ContactPhone $phone) use($contactPhone) { return $phone && $phone->getId() === $contactPhone->getId(); }); return $filtered->first(); }