Deletes a given incident.

@param \CachetHQ\Cachet\Models\Incident $incident

@return \Illuminate\Http\RedirectResponse
185526
public function deleteIncidentAction(Incident $incident)
    {
        execute(new RemoveIncidentCommand($incident));

        return cachet_redirect('dashboard.incidents')
            ->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.incidents.delete.success')));
    }
55564
public function delete($id = null)
    {
        if (! $id) {
            $id = $this->data->id;
        }

        return $this->client->delete('/{id}', ['id' => $id]);
    }
192253
public function deleteAction()
    {
        $id = (int) $this->params()->fromRoute('id', null);

        $request = $this->getRequest();

        if ($request->isPost()) {
            $confirmed = $request->getPost('confirmed', false);
            if ($confirmed) {
                $id = (int) $request->getPost('id');

                $this->getService()->delete($id);

                return $this->redirect()->toRoute($this->getRouteIdentifierPrefix());
            }
        }

        return new ViewModel(array(
            'options'  => $this->getOptions(),
        ));
    }
638534
protected function deleteActionException(\Exception $e)
    {
        $this->handleException($e);

        return new RedirectResponse($this->admin->generateUrl('list'));
    }
714997
public function delete()
    {
        if (!$this->isXmlHttpRequest()) {
            throw new \Exception("wrong request mode");
        }

        $deleted = $this->getClassService()->deleteInstance($this->getCurrentInstance());

        $this->returnJson(array(
            'deleted' => $deleted
        ));
    }
620956
public function delete() {
        $query = new DeleteQuery($this->getTable());
        $query->whereConditionGroup($this->getWhereConditionGroup());
        return $this->connection->exec($query);
    }
1083017
public function handle(IncidentWasCreatedEvent $event)
    {
        $incident = $event->incident;

        if (!$event->notify || !$this->system->canNotifySubscribers()) {
            return false;
        }

        // Only send emails for public incidents.
        if (!$incident->visible) {
            return;
        }

        // First notify all global subscribers.
        $globalSubscribers = $this->subscriber->isVerified()->isGlobal()->get();

        $globalSubscribers->each(function ($subscriber) use ($incident) {
            $subscriber->notify(new NewIncidentNotification($incident));
        });

        if (!$incident->component) {
            return;
        }

        $notified = $globalSubscribers->pluck('id')->all();

        // Notify the remaining component specific subscribers.
        $componentSubscribers = $this->subscriber
            ->isVerified()
            ->forComponent($incident->component->id)
            ->get()
            ->reject(function ($subscriber) use ($notified) {
                return in_array($subscriber->id, $notified);
            })->each(function ($subscriber) use ($incident) {
                $subscriber->notify(new NewIncidentNotification($incident));
            });
    }
644783
public function delete()
    {
        $url = $this->getEntityUrl() . $this->id;
        $r = new Request();

        return $r->request(Requests::DELETE, $url);
    }
628522
public function deleteAction($id, Request $request)
    {
        try {
            $mediaManager = $this->getMediaManager();

            $locale = $this->getLocale($request);

            $media = $mediaManager->getById($id, $locale);
            /** @var MediaInterface $mediaEntity */
            $mediaEntity = $media->getEntity();

            if (null !== $mediaEntity->getPreviewImage()) {
                $oldPreviewImageId = $mediaEntity->getPreviewImage()->getId();

                $mediaEntity->setPreviewImage(null);

                $mediaManager->delete($oldPreviewImageId);
            }

            $view = $this->view(null, 204);
        } catch (MediaNotFoundException $e) {
            $view = $this->view($e->toArray(), 404);
        } catch (MediaException $e) {
            $view = $this->view($e->toArray(), 400);
        }

        return $this->handleView($view);
    }
833995
public function delete(Request $request)
    {
        $this->validate(request(), [//@todo create custom Request class for page validation
            'page_id' => 'required',
        ]);
        
        $status = $this->page->deleteById($request->get('page_id'));
        return $status;
    }
202806
public function delete($id = null) {
		$this->request->allowMethod('post');
		$log = $this->DatabaseLogs->get($id);

		if ($this->DatabaseLogs->delete($log)) {
			$this->Flash->success(__('Log deleted'));
			return $this->redirect(['action' => 'index']);
		}
		$this->Flash->error(__('Log was not deleted'));
		return $this->redirect(['action' => 'index']);
	}
827603
public function actionDelete($id)
    {
        $model = $this->findModel($id);
        $model->delete();

        return $this->redirect(['index']);
    }
518538
public function deleteAction(Request $request, $mediaId)
    {
        $em = $this->getDoctrine()->getManager();

        /* @var Media $media */
        $media = $em->getRepository('KunstmaanMediaBundle:Media')->getMedia($mediaId);
        $medianame = $media->getName();
        $folder = $media->getFolder();

        $em->getRepository('KunstmaanMediaBundle:Media')->delete($media);

        $this->addFlash(
            FlashTypes::SUCCESS,
            $this->get('translator')->trans(
                'kuma_admin.media.flash.deleted_success.%medianame%',
                [
                    '%medianame%' => $medianame,
                ]
            )
        );

        // If the redirect url is passed via the url we use it
        $redirectUrl = $request->query->get('redirectUrl');
        if (empty($redirectUrl) || (\strpos($redirectUrl, $request->getSchemeAndHttpHost()) !== 0 && \strpos($redirectUrl, '/') !== 0)) {
            $redirectUrl = $this->generateUrl(
                'KunstmaanMediaBundle_folder_show',
                ['folderId' => $folder->getId()]
            );
        }

        return new RedirectResponse($redirectUrl);
    }
290499
public function deleteAction()
    {
        $server = (new \Cms\Orm\CmsMailServerQuery)->findPk($this->id);
        try {
            if ($server && $server->delete()) {
                $this->getMessenger()->addMessage('messenger.mailServer.deleted');
            }
        } catch (\Mmi\Db\Exception $e) {
            $this->getMessenger()->addMessage('messenger.mailServer.delete.error', false);
        }
        $this->getResponse()->redirect('cmsAdmin', 'mailServer');
    }
1307970
public function removeAction(Request $request): Response
    {
        $form = $this->formFactory->removeLocation(
            new ContentLocationRemoveData()
        );
        $form->handleRequest($request);

        /** @var \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo */
        $contentInfo = $form->getData()->getContentInfo();

        if ($form->isSubmitted()) {
            $result = $this->submitHandler->handle($form, function (ContentLocationRemoveData $data) {
                $contentInfo = $data->getContentInfo();

                foreach ($data->getLocations() as $locationId => $selected) {
                    $location = $this->locationService->loadLocation($locationId);
                    $this->locationService->deleteLocation($location);

                    $this->notificationHandler->success(
                        $this->translator->trans(
                            /** @Desc("Location '%name%' removed.") */
                            'location.delete.success',
                            ['%name%' => $location->getContentInfo()->name],
                            'location'
                        )
                    );
                }

                return new RedirectResponse($this->generateUrl('_ezpublishLocation', [
                    'locationId' => $contentInfo->mainLocationId,
                    '_fragment' => LocationsTab::URI_FRAGMENT,
                ]));
            });

            if ($result instanceof Response) {
                return $result;
            }
        }

        return $this->redirect($this->generateUrl('_ezpublishLocation', [
            'locationId' => $contentInfo->mainLocationId,
            '_fragment' => LocationsTab::URI_FRAGMENT,
        ]));
    }
380938
public function destroy($id)
    {
        $currentUser = $this->users->getUser();

        if ($currentUser->id === (int) $id)
        {
            return Redirect::back()
                ->with('error', Lang::get('cpanel::users.delete_denied') );
        }

        try
        {
            $this->users->delete($id);
            return Redirect::route('cpanel.users.index')
                ->with('success',Lang::get('cpanel::users.delete_success'));
        }
        catch (UserNotFoundException $e)
        {
            return Redirect::route('cpanel.users.index')
                ->with('error',$e->getMessage());
        }
    }
875119
public function delete(string $id = null)
    {
        $this->request->allowMethod(['post', 'delete']);
        $role = $this->Roles->get($id);
        if ($this->Roles->delete($role)) {
            $this->Flash->success((string)__('The role has been deleted.'));
        } else {
            $this->Flash->error((string)__('The role could not be deleted. Please, try again.'));
        }

        return $this->redirect(['action' => 'index']);
    }