Destroy given contact.

@param \Cortex\Contacts\Models\Contact $contact

@throws \Exception

@return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse
338670
public function destroy(Contact $contact)
    {
        $contact->delete();

        return intend([
            'url' => route('managerarea.contacts.index'),
            'with' => ['warning' => trans('cortex/foundation::messages.resource_deleted', ['resource' => trans('cortex/contacts::common.contact'), 'identifier' => $contact->full_name])],
        ]);
    }
751666
public function deleteNote(Note $note, Contact $contact)
    {
        $this->connector->delete($note, $contact);
        return $this;
    }
789129
def destroy
      @contact = Contact.find(params[:id])
      @contact.destroy
  
      respond_to do |format|
        format.html { redirect_to contacts_url }
        format.json { head :no_content }
      end
    end
44564
public function deleteFromId( $ContactNumberId){
        $rest = $this->getService( self::API_NUMBER . $ContactNumberId);
        $rest->DELETE();

        return $rest->getSuccess();
    }
1238196
public function setContact($contact)
    {
        if ($contact instanceof Contact) {
            $contact = $contact->getId();
        }

        $this->contact = $contact;

        return $this;
    }
850630
public function destroy($id)
    {
        try {
            if (($ret = $this->callDeleting()) instanceof Response) {
                return $ret;
            }

            collect(explode(',', $id))->filter()->each(function ($id) {
                $builder = $this->model()->newQuery();

                if ($this->isSoftDeletes) {
                    $builder = $builder->withTrashed();
                }

                $model = $builder->with($this->getRelations())->findOrFail($id);

                if ($this->isSoftDeletes && $model->trashed()) {
                    $this->deleteFiles($model, true);
                    $model->forceDelete();

                    return;
                }

                $this->deleteFiles($model);
                $model->delete();
            });

            if (($ret = $this->callDeleted()) instanceof Response) {
                return $ret;
            }

            $response = [
                'status'  => true,
                'message' => trans('admin.delete_succeeded'),
            ];
        } catch (\Exception $exception) {
            $response = [
                'status'  => false,
                'message' => $exception->getMessage() ?: trans('admin.delete_failed'),
            ];
        }

        return response()->json($response);
    }
851280
public function updateContactPoint(ContactPoint $contactPoint)
    {
        if (is_null($this->contactPoint) || !$this->contactPoint->sameAs($contactPoint)) {
            $this->apply(
                $this->createContactPointUpdatedEvent($contactPoint)
            );
        }
    }
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)
398577
public function deleteFromId( $contactAddressId){
        $rest = $this->getService( self::API_ADDRESS . $contactAddressId);
        $rest->DELETE();

        return $rest->getSuccess();
    }
24575
public function saveContact($contact)
	{
		if($contact->id > 0) // update
		{
			$contact->isNewRecord=false;
			if(($oldContact=Contact::model()->findByPk($contact->id))!==null)
			{
				$oldContact->attributes=$contact->attributes;
				return $oldContact->save();
			}
			else
				return false;
		}
		else // insert
		{
			$contact->isNewRecord=true;
			$contact->id=null;
			return $contact->save();
		}
	}
895757
public function removeContact(int $index): void
    {
        unset($this->contacts[$index]);
        $this->contacts = array_values($this->contacts);
    }
375678
public function removeContact($contact_id = null, $id = null)
    {
        if (is_null($contact_id) || is_null($id)) {
            throw new InvalidArgumentException('Null Contact or Group id.');
        }
        $ResourceName = $this->resourceName . ($id ? '/' . $id . '/contacts/' . $contact_id : null);

        list($responseStatus, , $responseBody) = $this->HttpClient->performHttpRequest(
            Common\HttpClient::REQUEST_DELETE,
            $ResourceName
        );
        if ($responseStatus !== Common\HttpClient::HTTP_NO_CONTENT) {
            return json_decode($responseBody);
        }
    }
1274567
public function destroy(Customer $customer)
    {
        try {
            $name = $customer->getName();
            $customer->delete();

            flash()->info(__('Customer :name has been deleted', ['name' => $name]));
        } catch (\Exception $e) {
            flash()->error(__('Error: :msg', ['msg' => $e->getMessage()]));
        }

        return redirect(route('appshell.customer.index'));
    }
274816
public function processEmails($contact, $emails)
    {
        $get = function($email) {
            /* @var Email $email */

            return $email->getId();
        };

        $delete = function($email) use ($contact) {
            return $contact->removeEmail($email);
        };

        $update = function($email, $matchedEntry) {
            return $this->updateEmail($email, $matchedEntry);
        };

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

        $entities = $contact->getEmails();

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

        $this->resetIndexOfSubentites($entities);

        // check main
        $this->setMainEmail($contact);

        return $result;
    }
883698
public function changeEmail($listId, Contact $contact, $oldEmail)
    {
        // get old contact properties
        $response = $this->mailjet->get(Resources::$Contactdata, ['id' => $oldEmail]);
        if (!$response->success()) {
            $this->throwError("ContactsListManager:changeEmail() failed", $response);
        }

        // copy contact properties
        $oldContactData = $response->getData();
        if (isset($oldContactData[0])) {
            $contact->setProperties($oldContactData[0]['Data']);
        }

        // add new contact
        $contact->setAction(Contact::ACTION_ADDFORCE);
        $response = $this->_exec($listId, $contact);
        if (!$response->success()) {
            $this->throwError("ContactsListManager:changeEmail() failed", $response);
        }

        // remove old
        $oldContact = new Contact($oldEmail);
        $oldContact->setAction(Contact::ACTION_REMOVE);
        $response = $this->_exec($listId, $oldContact);
        if (!$response->success()) {
            $this->throwError("ContactsListManager:changeEmail() failed", $response);
        }

        return $response->getData();
    }
860204
public function deleteAction()
    {
        $contact = (new \Cms\Orm\CmsContactQuery)->findPk($this->id);
        if ($contact && $contact->delete()) {
            $this->getMessenger()->addMessage('messenger.contact.message.deleted', true);
        }
        $this->getResponse()->redirect('cmsAdmin', 'contact');
    }
883021
public function setContacts(array $contacts): SecurityTxt
    {
        if (!$this->validContacts($contacts, true)) {
            throw new Exception('Contacts array must contain well-formed e-mails and/or URLs.');
        }

        $this->contacts = $contacts;

        return $this;
    }