Deletes an existing Menu model.
If deletion is successful, the browser will be redirected to the 'index' page.
@param  integer $id
@return mixed
769811
public function actionDelete($id)
    {
        $request = \Yii::$app->request;
        if ($request->getIsOptions()) {
            return $this->ResponseOptions($this->verbs()['delete']);
        }
        $this->findModel($id)->delete();
        Helper::invalidate();

        return ["success"=> true];
    }
1077787
public function deleteAction($id)
    {
        $delete = $this->getUserManager()->delete();
        $view = $this->responseDelete($id, $delete);

        return $this->handleView($view);
    }
597230
private function deleteCategory(int $id)
    {
        $category = Category::find($id);
        if($category) {
            $postType = PostType::findByID($category->postTypeID);
            if(Category::isInMenuLinks($id)) {
                return $this->response("You can't delete this Category. It is part of a menu", 403);
            }

            // delete children
            $category->deleteChildren($category->categoryID, $postType->postTypeID);

            // delete relations
            DB::table(categoriesRelationTable($postType->slug))->where("categoryID", $category->categoryID)->delete();

            // Delete the item
            if($category->delete()) {
                return true;
            }
        }
        return false;
    }
1318783
public function actionDelete($id)
    {
        $this->findModel($id)->delete();
        if (Yii::$app->request->getIsAjax()) {
            \Yii::$app->response->format = 'json';
            return ['success' => true];
        } else {
            return $this->redirect(['index']);
        }
    }
1365968
public function actionDelete($id)
    {
        $date = new DateTime('now');
        $model = $this->findModel($id);
        $model->deleted_at = $date->format("U");
        $model->save();

        return $this->redirect(['index']);
    }
503887
public function destroy($id)
    {
        $image = $this->repository->find($id);

        if (is_file(storage_path($image->location))) {
            Storage::delete($image->location);
        } else {
            Storage::disk(Config::get('cms.storage-location', 'local'))->delete($image->location);
        }

        if (empty($image)) {
            Cms::notification('Image not found', 'warning');

            return redirect(route($this->routeBase.'.images.index'));
        }

        $image->forgetCache();
        $image->delete();

        Cms::notification('Image deleted successfully.', 'success');

        return redirect(route($this->routeBase.'.images.index'));
    }
947800
public function destroy($id)
    {
        $record = $this->modelRepository->findOrFail($id);

        if ( ! $this->isModelDeletable($record)) {
            return $this->failureResponse(
                $this->getLastUnmetDeleteConditionMessage()
            );
        }

        event( new Events\DeletingModelInCms($record) );

        if ( ! $this->deleteModel($record)) {
            // @codeCoverageIgnoreStart
            return $this->failureResponse(
                cms_trans('models.delete.failure.unknown')
            );
            // @codeCoverageIgnoreEnd
        }

        event( new Events\ModelDeletedInCms($this->getModelInformation()->modelClass(), $id) );

        if (request()->ajax()) {
            return response()->json([
                'success' => true,
            ]);
        }

        cms_flash(
            cms_trans(
                'models.delete.success-message',
                [ 'record' => $this->getSimpleRecordReference($id, $record) ]
            ),
            FlashLevel::SUCCESS
        );

        return redirect()->back();
    }
282394
public function delete($id)
	{
		Yii::trace('Deleting "'.$id.'" from cache','system.caching.'.get_class($this));
		return $this->deleteValue($this->generateUniqueKey($id));
	}
806405
public function actionDelete($id)
    {
        if (Yii::$app->request->isPost) {
            $this->findModel($id)->delete();
        }
        return $this->redirect(['index']);
    }
770125
public function deleteAction($id)
    {
        $manager = $this->get('opifer.redirect.redirect_manager');

        $redirect = $manager->getRepository()->find($id);

        $manager->remove($redirect);
        $this->addFlash('success', $this->get('translator')->trans('opifer_redirect.flash.deleted'));

        return $this->redirectToRoute('opifer_redirect_redirect_index');
    }
38380
public function destroy($id)
    {
        $this->model = $this->model->findOrFail($id);

        $this->runChecks('destroy', $this->model->toArray());

        return $this->model->delete();
    }
1280573
public function delete($id)
    {
        $result = Eresus_CMS::getLegacyKernel()->db->delete($this->table, "`id`=$id");
        return $result;
    }
1269001
public function deleteAction($id)
    {
        $em = $this->getDoctrine()->getManager();
        $site = $em->getRepository(Site::class)->find($id);

        $em->remove($site);
        $em->flush();

        return $this->redirectToRoute('opifer_cms_site_index');
    }
1030052
public function actionRemove(int $id)
    {

        RelatedProduct::deleteAll(['id' => $id]);

        return $this->redirect(\Yii::$app->request->referrer);
    }
416693
protected static function doDelete($id)
    {
        $model = self::createModelInstance();
        $tableName = $model->getTableName($model->className);

        $connection = Connection::connect();

        $delete = $connection->prepare('delete from '.$tableName.' where id ='.$id);
        return $delete->execute() ? 'deleted successfully' : 'Row not deleted';

         
    }
704451
public function actionDelete($id)
    {
        $model = $this->findModel($id);
        
        if ($model->is_active == false) {
            $model->delete();
            Yii::$app->session->setFlash('success', Yii::t($this->tcModule,"Module has been deleted"));
        } else {
            Yii::$app->session->setFlash('error', Yii::t($this->tcModule,"Can't delete active module"));
        }

        $params = Yii::$app->request->getQueryParams();
        $params['id'] = $model->id;
        $params[] = 'index';
        return $this->redirect($params);
    }
539176
public function delete($id)
    {
        try {
            $this->permissionRepositoryInterface->delete($id);
        } catch (PermissionsException $e) {
            Flash::error($e->getMessage());

            return redirect()->route('permissions.index');
        }

        Flash::success(trans('dashboard::dashboard.flash.permission.delete.success'));

        return redirect()->route('permissions.index');
    }