DELETE: Delete posts in bulk.

@param  Request  $request
@return \Illuminate\Http\RedirectResponse
172405
public function bulkDestroy(Request $request)
    {
        $this->validate($request, ['action' => 'in:delete,permadelete']);

        $parameters = $request->all();

        $parameters['force'] = 0;
        if (!config('forum.preferences.soft_deletes') || ($request->input('action') == 'permadelete')) {
            $parameters['force'] = 1;
        }

        $posts = $this->api('bulk.post.delete')->parameters($parameters)->delete();

        return $this->bulkActionResponse($posts, 'posts.deleted');
    }
887129
public function deleteAction(Request $request, $id)
    {
        $locale = $this->getLocaleManager()->retrieveLocale($this->getUser(), $request->get('locale'));

        $delete = function ($id) use ($locale){
            $this->getManager()->delete($id, $this->getUser()->getId());
        };
        $view = $this->responseDelete($id, $delete);

        return $this->handleView($view);
    }
1290431
public function deleteAjaxAction( Request $request ) {
		$id          = $request->get( 'id' );
		$pageId      = $request->get( 'pageId' );
		$uniqId      = $request->get( 'uniqId' );
		$code        = $request->get( 'code' );
		$formFieldId = $request->get( 'formFieldId' );

		if ( $id ) {
			$layoutBlock = $this->admin->getObject( $id );
			if ( $layoutBlock ) {
				$this->admin->delete( $layoutBlock );
			}
		}
		$html = $this->getLayoutBlockFormWidget( $pageId, $formFieldId, $uniqId, $code );

		return new JsonResponse( [
			'messageStatus' => 'success',
			'message'       => $this->translate( 'message.layout_block_deleted' ),
			'html'          => $html,
		] );
	}
493708
public function deleteAction(Request $request)
    {
        $this->mapper->delete($this->mapper->getResource($request->get('id')));

        return new Response('', 204);
    }
51815
public function deleteAction(Request $request, Departamento $departamento)
    {
        $form = $this->createDeleteForm($departamento);
        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->remove($departamento);
            $em->flush();
        }

        return $this->redirectToRoute('departamento_index');
    }
1221396
public function send(Request $request)
    {
        $response   = new DeleteResponse();
        $rpbPutReq  = $this->createRpbMessage($request);

        $this->client->send($rpbPutReq, RiakMessageCodes::DEL_REQ, RiakMessageCodes::DEL_RESP);

        return $response;
    }
579046
public function removeAction(Request $request)
    {
        $block = $this->findBlockByRequest($request);
        $row = $block->getRow();

        try {
            $this->getEditor()->getBlockManager()->delete($block);
        } catch (EditorExceptionInterface $e) {
            return $this->handleException($e);
        }

        // Stores id for front removal
        $removedId = $this->getViewBuilder()->buildBlock($block)->getAttributes()->getId();

        $this->validate($row);
        $this->persist($row);

        $data = [
            'removed' => [$removedId],
            //'rows'    => [$this->getViewBuilder()->buildRow($row)],
        ];

        return $this->buildResponse($data, self::SERIALIZE_LAYOUT);
    }
334264
public function send(Request $request)
    {
        $response      = new DeleteIndexResponse();
        $rpbDeleteReq  = $this->createRpbMessage($request);

        $this->client->send($rpbDeleteReq, RiakMessageCodes::YOKOZUNA_INDEX_DELETE_REQ, RiakMessageCodes::DEL_RESP);

        return $response;
    }
472864
public function destroy(Request $request)
    {
        $permanent = !config('forum.preferences.soft_deletes');

        $parameters = $request->all();
        $parameters['force'] = $permanent ? 1 : 0;

        $post = $this->api('post.delete', $request->route('post'))->parameters($parameters)->delete();

        Forum::alert('success', 'posts.deleted', 1);

        return redirect(Forum::route('thread.show', $post->thread));
    }
530352
public function removeRequest(Request $request) {
        $oid = spl_object_hash($request);
        $result = false;

        if(isset($this->requests[$oid])) {
            unset($this->requests[$oid]);
            $result = $request;
            curl_multi_remove_handle($this->handle, $request->getHandle());
        }

        return $result;
    }
1061767
public function bulkDelete(Request $request)
    {
        // check if user has permissions to access this link
        if(!User::hasAccess('CustomField', 'delete')) {
            return $this->noPermission();
        }
        $data = $request->all();
        foreach ($data as $id){
            $customFieldsGroup = CustomFieldGroup::find($id)->delete();
            if (!$customFieldsGroup) {
                return $this->response('Internal server error. Please try again later', 500);
            }else{
                CustomField::where('customFieldGroupID', $id)->delete();
                // TODO me i fshi vlerat e custom fildave neper poste, users dhe category
            }
        }
        return $this->response('Custom fields groups are deleted');
    }
7959
public function deleteAction(Request $request)
    {
        $volumeId = $request->get('site_id');
        $folderId = $request->get('folder_id');

        $volume = $this->getVolume($volumeId);
        $folder = $volume->findFolder($folderId);

        if ($folder->isRoot()) {
            return new ResultResponse(false, "Can't delete the root folder.");
        }

        $volume->deleteFolder($folder, $this->getUser()->getId());

        return new ResultResponse(true, 'Folder deleted', ['parent_id' => $folder->getParentId()]);
    }
485033
public function bulkDeleteAction(Request $request): Response
    {
        $this->denyAccessUnlessGranted(new Attribute('state', 'administrate'));
        $form = $this->formFactory->deleteObjectStateGroups(
            new ObjectStateGroupsDeleteData()
        );
        $form->handleRequest($request);

        if ($form->isSubmitted()) {
            $result = $this->submitHandler->handle($form, function (ObjectStateGroupsDeleteData $data) {
                foreach ($data->getObjectStateGroups() as $objectStateGroupId => $selected) {
                    $objectStateGroup = $this->objectStateService->loadObjectStateGroup($objectStateGroupId);
                    $this->objectStateService->deleteObjectStateGroup($objectStateGroup);

                    $this->notificationHandler->success(
                        $this->translator->trans(
                            /** @Desc("Object state group '%name%' deleted.") */
                            'object_state_group.delete.success',
                            ['%name%' => $objectStateGroup->getName()],
                            'object_state'
                        )
                    );
                }
            });

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

        return $this->redirectToRoute('ezplatform.object_state.groups.list');
    }
752283
public function delete(HTTPRequest $request)
    {
        $response = new HTTPBulkToolsResponse(true, $this->gridField);

        try {
            foreach ($this->getRecords() as $record) {
                $response->addSuccessRecord($record);
                $record->delete();
            }

            $doneCount = count($response->getSuccessRecords());
            $message = sprintf(
                'Deleted %1$d records.',
                $doneCount
            );
            $response->setMessage($message);
        } catch (Exception $ex) {
            $response->setStatusCode(500);
            $response->setMessage($ex->getMessage());
        }

        return $response;
    }
800972
public function remove(Request $request)
    {
        $app = $this->app;

        $store = $this->getStore();

        if (method_exists($this, 'beforeRemove')) {
            $response = $this->beforeRemove($request);

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

        $ids = $request->get('ids', array());

        if (count($ids) == 0) {
            $ids[] = $request->get('id');
        }

        $success = true;

        foreach ($ids as $idx => $id) {
            if (!$store->remove($id)) {
                $success = false;
            }
        }

        $response = [
            'success' => $success
        ];

        if (method_exists($this, 'afterRemove')) {
            $response = $this->afterRemove($request, $response);

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

        return $app->json($response);
    }
368507
public function deleteAction(Request $request)
    {
        $siterootId = $request->get('id');

        $siterootManager = $this->get('phlexible_siteroot.siteroot_manager');

        $siteroot = $siterootManager->find($siterootId);
        $siterootManager->deleteSiteroot($siteroot);

        return new ResultResponse(true, 'Siteroot deleted.');
    }
69045
public function deleteAction(Request $request, $id)
    {
        $configuration = $this->getConfiguration($request);
        $dispatcher = $configuration->getEventDispatcher();
        $object = $this->findObject($request, $id);

        $event = new PreFlushEvent($configuration, $request, $object);
        $dispatcher->dispatch(CrudEvents::PRE_FLUSH, $event);

        if ($event->hasResponse()) {
            return $event->getResponse();
        }

        $event = new PostFlushEvent($configuration, $request, $object);
        $om = $this->getObjectManager();
        $om->remove($object);

        try {
            $om->flush();
            $this->addFlash('success', sprintf('flash.%s.delete.success', $configuration->getName()));
        } catch (\Exception $e) {
            $event->setException($e);
            $this->addFlash('error', sprintf('flash.%s.delete.error', $configuration->getName()));
        }

        $dispatcher->dispatch(CrudEvents::POST_FLUSH, $event);

        if ($event->hasResponse()) {
            return $event->getResponse();
        }

        return $this->redirectToRoute(
            $configuration->getRoutePrefix() . 'index',
            $configuration->getRouteParameters()
        );
    }