Deletes given contact.

@param  Contact  $contact
@return bool

@throws \Exception
3431
public function deleteContact(Contact $contact)
    {
        if ($this !== $contact->contactable()->first())
            return false;

        return $contact->delete();
    }
923225
public function delete(Contact $contact): void
    {
        $id = $contact->getId();

        $contact->setId(null);

        $this->client->delete($this->prepareUrlForKey('delete-contact', ['id' => $id]));
    }
476519
public function setContact(\WobbleCode\UserBundle\Document\Contact $contact)
    {
        $this->contact = $contact;

        return $this;
    }
198467
def delete_contact(self, contact_id):
        
        url = self.CONTACTS_ID_URL % contact_id

        connection = Connection(self.token)
        connection.set_url(self.production, url)

        return connection.delete_request()
786458
public function actionDelete($id)
    {
        try{
            return $this->findModel($id)->delete();
        }catch(Exception $e){
            throw new Exception($e);
        }

    }
1002023
public function processTags($contact, $tags)
    {
        $get = function($tag) {
            return $tag->getId();
        };

        $delete = function($tag) use ($contact) {
            return $contact->removeTag($tag);
        };

        $update = function() {
            return true;
        };

        $add = function($tag) use ($contact) {
            return $this->addTag($contact, $tag);
        };

        $entities = $contact->getTags();

        $result = $this->processSubEntities(
            $entities,
            $tags,
            $get,
            $add,
            $update,
            $delete
        );

        $this->resetIndexOfSubentites($entities);

        return $result;
    }
1253865
public function hasContacts(array $contacts): bool
    {
        foreach ($contacts as $contact) {
            if (!$this->hasContact($contact)) {
                return false;
            }
        }

        return true;
    }
1162309
public function save(ServiceInterface $service, Contact $contact = null)
    {
        if (!$this->validate()) {
            throw new NotValidException('Unable to validate contact note');
        }

        if ($contact === null) {
            throw new Exception('$contact must be instance of Contact');
        }

        $newContact = $service->saveNote($this, $contact);
        $contact->setData($newContact->toArray(), false);
        return $this->reload(
            end($newContact->notes)
        );
    }
1350057
public function contactIsEmployeeOfAccount($contact, $account)
    {
        if ($contact->getAccountContacts() && !$contact->getAccountContacts()->isEmpty()) {
            foreach ($contact->getAccountContacts() as $accountContact) {
                if ($accountContact->getAccount()->getId() === $account->getId()) {
                    return true;
                }
            }
        }

        return false;
    }
44522
public static function remove_contact(int $userid, int $contactid) {
        global $DB;

        if ($contact = self::get_contact($userid, $contactid)) {
            $DB->delete_records('message_contacts', ['id' => $contact->id]);

            $event = \core\event\message_contact_removed::create(array(
                'objectid' => $contact->id,
                'userid' => $userid,
                'relateduserid' => $contactid,
                'context' => \context_user::instance($userid)
            ));
            $event->add_record_snapshot('message_contacts', $contact);
            $event->trigger();
        }
    }
978115
public function pushLead($contact, $event = [])
    {
        $this->reset();
        $this->getEvent($event);

        if (empty($this->event['config']['contactclient'])) {
            return false;
        }

        /** @var Contact $contactModel */
        $clientModel = $this->getContactClientModel();
        $client      = $clientModel->getEntity($this->event['config']['contactclient']);

        $this->sendContact($client, $contact, false);

        // Returning false will typically cause a retry.
        // If an error occurred and we do not wish to retry we should return true.
        return $this->valid ? $this->valid : !$this->retry;
    }
380354
public function email($contact)
    {
        if ($this->isStringLike($contact) && $this->isMapped($contact)) {
            return $this->mappedEmail($contact);
        }

        if ($this->isStringLike($contact) && $this->isEmailAddress($contact)) {
            return $contact;
        }

        if (!is_object($contact)) {
            throw new RuntimeException('No idea how to extract an email address of '.gettype($contact));
        }

        foreach ($this->possibleEmailMethods as $method) {
            if (method_exists($contact, $method)) {
                return $contact->{$method}();
            }
        }

        foreach ($this->possibleEmailProperties as $property) {
            if (isset($contact->{$property})) {
                return $contact->{$property};
            }
        }

        throw new RuntimeException('No idea how to extract an email address of '.get_class($contact));
    }
903384
public function onContactClientDelete(ContactClientEvent $event)
    {
        $entity = $event->getContactClient();
        $log    = [
            'bundle'    => 'contactclient',
            'object'    => 'contactclient',
            'objectId'  => $entity->deletedId,
            'action'    => 'delete',
            'details'   => ['name' => $entity->getName()],
            'ipAddress' => $this->ipHelper->getIpAddressFromRequest(),
        ];
        $this->auditLogModel->writeToLog($log);
    }
575197
public function deleteFromId( $ContactUrlId){
        $rest = $this->getService( self::API_URL . $ContactUrlId);
        $rest->DELETE();

        return $rest->getSuccess();
    }
44493
public function updateContactPassword(Contact $contact, $newPassword)
    {
        return $this->httpHelper->patch("accounts/" . $contact->getAccountID() . "/contacts/" . $contact->getContactID(), [
            'password' => $newPassword,
        ]);
    }
1046666
def delete_contact_method(self, id, **kwargs):
        """"""
        endpoint = '{0}/{1}/contact_methods/{2}'.format(
            self.endpoint,
            self['id'],
            id,
        )
        return self.request('DELETE', endpoint=endpoint, query_params=kwargs)
610499
public function updateContact(Contact $contact, array $attributes)
    {
        $attributes = $this->loadContactAttributes($attributes);

        return $contact->fill($attributes)->save();
    }