Delete action
POST

@param string $id
355392
public function delete($id)
    {
        $this->request->allowMethod('post');

        /** @var Page $page */
        $page = $this->Pages->get($id);

        if ($this->Pages->delete($page)) {
            $this->Flash->success(__d('wasabi_cms', 'The page <strong>{0}</strong> has been deleted.', $page->name));
        } else {
            $this->Flash->error($this->dbErrorMessage);
        }

        $this->redirect(['action' => 'index']);
        return;
    }
781393
public function delete(?string $id = null)
    {
        $this->request->allowMethod(['post', 'delete']);
        $calendarEvent = $this->CalendarEvents->get($id);
        if ($this->CalendarEvents->delete($calendarEvent)) {
            $this->Flash->success((string)__('The calendar event has been deleted.'));
        } else {
            $this->Flash->error((string)__('The calendar event could not be deleted. Please, try again.'));
        }

        return $this->redirect(['plugin' => 'Qobo/Calendar', 'controller' => 'Calendars', 'action' => 'index']);
    }
1151605
public function delete(string $id = null)
    {
        $this->request->allowMethod(['post', 'delete']);
        $language = $this->Languages->get($id);
        if ($this->Languages->delete($language)) {
            $this->Flash->success((string)__('The language has been deleted.'));
        } else {
            $this->Flash->error((string)__('The language could not be deleted. Please, try again.'));
        }

        return $this->redirect(['action' => 'index']);
    }
388590
public function delete($id = null) {
		$block = $this->Blocks->get($id);
		$this->request->allowMethod('post', 'delete');
		if ($this->Blocks->delete($block)) {
			$this->Flash->success('The block has been deleted.');
		} else {
			$this->Flash->error('The block could not be deleted. Please, try again.');
		}
		return $this->redirect(['action' => 'index']);
	}
324547
public function delete($id = null)
    {
        $user = $this->Users->get($id);
        $this->request->allowMethod(['post', 'delete']);

        if ($this->Users->delete($user)) {
            $this->Flash->success(__('The user has been deleted.'));
        } else {
            $this->Flash->error(__('The user could not be deleted. Please, try again.'));
        }

        return $this->redirect(['action' => 'index']);
    }
72516
public function delete($id)
    {
        $entity = $this->findById($id);
        $entity = $this->beforeDelete($entity);

        $this->getEntityManager()->remove($entity);
        $this->getEntityManager()->flush();

        $this->afterDelete($entity);
    }
984375
public function delete($id)
    {
        $this->loadModel('Comment.Comments');
        $comment = $this->Comments
            ->find()
            ->where(['Comments.id' => $id, 'Comments.table_alias' => $this->_manageTable])
            ->first();

        if ($comment) {
            if ($this->Comments->delete($comment)) {
                $this->Flash->success(__d('comment', 'Comment was successfully deleted!'));
            } else {
                $this->Flash->danger(__d('comment', 'Comment could not be deleted, please try again.'));
            }
        } else {
            $this->Flash->danger(__d('comment', 'Invalid comment, comment was not found.'));
        }

        $this->title(__d('comment', 'Delete Comment'));
        $this->redirect($this->referer());
    }
1023142
public function actionDelete($id)
    {
        $this->findModel($id)->updateAttributes(['status' => User::STATUS_DELETED]);

        return $this->redirect(['index']);
    }
1230929
public function deleteAction($id)
    {
        $delete = function ($id) {
            $this->getManager()->delete($id);
        };
        $view = $this->responseDelete($id, $delete);

        return $this->handleView($view);
    }
748947
private function deleteTag($id)
    {
        $tags = Tag::find($id);
        if(Tag::hasPosts($id)) {
            return $this->response("You can't delete this Tag. There are posts associated with it.", 403);
        }
        if ($tags->delete()) {
            return true;
        }
        return false;
    }
840663
public function deleteAction($id)
    {
        $this->checkCsrf();

        $transUnit = $this->get('lexik_translation.translation_storage')->getTransUnitById($id);

        if (!$transUnit) {
            throw $this->createNotFoundException(sprintf('No TransUnit found for id "%s".', $id));
        }

        $deleted = $this->get('lexik_translation.trans_unit.manager')->delete($transUnit);

        return new JsonResponse(array('deleted' => $deleted), $deleted ? 200 : 400);
    }
275245
public function actionDelete($id)
    {
        $model = $this->findModel($id);
        Configs::authManager()->remove($model->item);
        Helper::invalidate();

        return $this->redirect(['index']);
    }
218692
public function delete($id = null)
    {
        $this->request->allowMethod(['post', 'delete']);

        $photo = $this->Photos->get($id);
        $this->Photos->deleteOrFail($photo);
        $this->Flash->success(I18N_OPERATION_OK);

        return $this->redirect(['action' => 'index', $photo->album_id]);
    }
939031
private function deleteById($id)
    {
        $builder = $this->repository->createQueryBuilder();
        $builder
            ->remove()
            ->field('id')->equals($id)
            ->getQuery()
            ->execute();
    }
609028
public function delete($id = null) {
        $user = $this->Users->get($id);
        if ($this->request->is(['patch', 'post', 'put'])) {
            if ($this->Users->delete($user)) {
                $this->Flash->success(__('The user has been deleted.'));
            } else {
                $this->Flash->error(__('The user could not be deleted. Please, try again.'));
            }
            return $this->redirect(['action' => 'index']);
        }
        $this->set(compact('user'));
    }
1172918
public function destroy($id)
      {
        Permission::destroy($id);
        \Session::flash('flash_message', 'Permission deleted!');
        return \Redirect::route('admin.permissions.index', [
          ])->withMessage(trans('acl::permission.permissions-controller-successfully_deleted'));
        }
314425
public function delete($id)
    {
        $entity = $this->get($id);

        $this->manager->remove($entity);
        $this->manager->flush();
    }