Deletes multiple documents.

@param Request $request

@return Response
342422
public function cdeleteAction(Request $request)
    {
        $ids = array_filter(explode(',', $request->get('ids', '')));

        $documentManager = $this->getDocumentManager();
        foreach ($ids as $id) {
            $document = $documentManager->find($id);
            $documentManager->remove($document);
            $documentManager->flush();
        }

        return $this->handleView($this->view(null));
    }
1187921
public function removeAction(Request $request): Response
    {
        $form = $this->formFactory->removeCustomUrl();
        $form->handleRequest($request);

        $location = $form->getData()->getLocation();

        if ($form->isSubmitted()) {
            $result = $this->submitHandler->handle($form, function (CustomUrlRemoveData $data) {
                $aliasToRemoveList = [];
                foreach ($data->getUrlAliases() as $customUrlId => $selected) {
                    $aliasToRemoveList[] = $this->urlAliasService->load($customUrlId);
                }
                $this->urlAliasService->removeAliases($aliasToRemoveList);

                return $this->redirectToLocation($data->getLocation(), UrlsTab::URI_FRAGMENT);
            });

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

        if ($location) {
            return $this->redirectToLocation($location, UrlsTab::URI_FRAGMENT);
        }

        return $this->redirectToRoute('ezplatform.dashboard');
    }
508002
public function findAndPaginateDeletes(Request $request)
    {
        return $this->getModel()
                    ->onlyTrashed()
                    ->titulo($request->get('titulo'))
                    ->orderBy('deleted_at', 'desc')
                    ->paginate();
    }
247061
public function destroy(Request $request, $id)
    {
        $deleted = (new Services\GroupsService)->dataDelete($id, $request->all());
        return response()->json(['deleted' => $deleted]);
    }
1337052
public function deleteImage(Request $request)
    {
        $path = $request->get('path');

        $path = 'uploads/catalog/images/e/0/v/1382542458778.jpeg';
        $fileName = pathinfo($path, PATHINFO_BASENAME);
        $relativeDir = pathinfo($path, PATHINFO_DIRNAME);

        $sizes = config('avored-framework.image.sizes');
        foreach ($sizes as $sizeName => $widthHeight) {
            $imagePath = $relativeDir . DIRECTORY_SEPARATOR . $sizeName . '-' . $fileName;
            if (File::exists($imagePath)) {
                File::delete(storage_path('app/public/' . $imagePath));
            }
        }

        if (File::exists($path)) {
            File::delete(storage_path('app/public/' . $path));
        }
        return JsonResponse::create(['success' => true]);
    }
1041104
public function sort(Request $request)
    {
        collect($request->get('files'))
            ->each(function ($sort, $id) {
                $attachment = Attachment::find($id);
                $attachment->sort = $sort;
                $attachment->save();
            });

        return response(200);
    }
479054
public function destroy(Request $request, $page)
    {
        // Set roles that have access
        $request->user()->authorizeRoles(['admin', 'editor']);

        $page = Page::withTrashed()->findOrFail($page);

        if ($page->trashed() && !$request->input('confirm_delete')) {
            return redirect()->route('admin.pages.page.delete', $page);
        }

        if ($request->input('confirm_delete')) {
            $page->forceDelete();
            return redirect()->route('admin.pages.index.trashed');
        }

        $page->status = 1;
        $page->save();
        $page->delete();

        flash('Page has been moved to trash')->success();

        return back();
    }
1236538
public function cdeleteAction(Request $request)
    {
        $manager = $this->getTaskManager();

        $ids = array_filter(explode(',', $request->get('ids')));
        foreach ($ids as $id) {
            $manager->remove($id);
        }

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

        return $this->handleView($this->view());
    }
1072312
public function deleteCategory(Request $request)
    {
        $this->validate(
            $request,
            [
                'category_id' => 'required|integer|exists:categories',
            ]
        );

        $category = Category::find($request->input('category_id'));

        if ($category->items()->count()) {
            return redirect()->back()->withErrors(['category_id' => trans('mustard::admin.category_has_items')]);
        }

        $category->delete();

        return redirect()->back()->withStatus(trans('mustard::admin.category_deleted'));
    }
167850
public function bulkDelete(Request $request)
    {
        // check if user has permissions to access this link
        if(!User::hasAccess('PostType', 'delete')) {
            return $this->noPermission();
        }
        // if there are no item selected
        if (count($request->all()) <= 0) {
            return $this->response('Please select items to be deleted', 500);
        }

        // loop throw the item array (ids) and delete them
        foreach($request->all() as $id){
            $res = $this->deletePostType($id);
            if(!$res) {
                return $this->response('Post Type could not be deleted. Please try again later or contact your Administrator!', 500);
            }
            if(!is_bool($res)) {
                return $res;
            }
        }
        return $this->response('Selected post types are successfully deleted', 200);
    }
634535
public function deleteFile(Request $request)
    {
        $namespace = $request->request->get('namespace');
        $filename = $request->request->get('filename');

        try {
            $this->filesystem()->delete("$namespace://$filename");

            return $this->json($filename, Response::HTTP_OK);
        } catch (ExceptionInterface $e) {
            $msg = Trans::__('Unable to delete file: %FILE%', ['%FILE%' => $filename]);
            $this->logException($msg, $e);

            return $this->json(
                $msg,
                $e instanceof FileNotFoundException ? Response::HTTP_NOT_FOUND : Response::HTTP_INTERNAL_SERVER_ERROR
            );
        }
    }
91422
public function multipledeleteinfoAction(Request $request)
    {
        $ids = $request->get('ids');

        $response = [];
        $numContacts = 0;
        $numChildren = 0;

        foreach ($ids as $id) {
            $account = $this->getRepository()->countDistinctAccountChildrenAndContacts($id);

            // Get number of subaccounts.
            $numChildren += $account['numChildren'];

            // FIXME: Distinct contacts: (currently the same contacts could be counted multiple times).
            // Get full number of contacts.
            $numContacts += $account['numContacts'];
        }

        $response['numContacts'] = $numContacts;
        $response['numChildren'] = $numChildren;

        $view = $this->view($response, 200);

        return $this->handleView($view);
    }
307657
protected function deleteFile(Request $request)
    {
        try {
            $file = $request->input('s');
            Storage::delete($file);

            return $this->notifySuccess($file . ' successfully deleted!');
        } catch (\ErrorException $e) {
            return $this->notifyError($e->getMessage());
        }
    }
1289551
public function deleteItemCondition(Request $request)
    {
        $this->validate(
            $request,
            [
                'item_condition_id' => 'required|integer|exists:item_conditions',
            ]
        );

        $item_condition = ItemCondition::find($request->input('item_condition_id'));

        if ($item_condition->items()->count()) {
            return redirect()->back()->withErrors(['item_condition_id' => trans('mustard::admin.item_condition_has_items')]);
        }

        $item_condition->delete();

        return redirect()->back()->withStatus(trans('mustard::admin.item_condition_deleted'));
    }
1129133
public function deleteMedia(Request $request)
    {
        // if single file/folder '?s=name'
        if ($request->has('s')) {
            if (is_dir(storage_path('app') . DIRECTORY_SEPARATOR . $request->input('s'))) {
                return $this->deleteDirectory($request);
            } else {
                return $this->deleteFile($request);
            }
        }

        // if multiple files
        if ($request->has('files')) {
            Storage::delete($request->input('files'));
        }

        // if multiple directories
        if ($request->has('directories')) {
            if (is_array($request->input('directories'))) {
                foreach ($request->input('directories') as $directory) {
                    Storage::deleteDirectory($directory);
                }
            } else {
                Storage::deleteDirectory($request->input('directories'));
            }
        }

        if ($request->wantsJson()) {
            return $this->notifySuccess('File/Folder deleted successfully!');
        }

        flash()->success('File/Folder deleted successfully!');

        return redirect()->back();
    }
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');
    }
248039
public function templatesByLangDeleteBulkAction(Request $request)
    {
        $query = $request->query->all();
        $options = $this->options['deleteBulk'];

        if (isset($query['options'])) {
            $options = $query['options'];
        }
        $templateRepo = $this->om->getRepository(Template::class);
        $toDelete = [];
        $templates = $this->decodeIdsString($request, Template::class);

        foreach ($templates as $template) {
            $localizedTemplates = $templateRepo->findBy([
                'name' => $template->getName(),
                'type' => $template->getType(),
            ]);
            foreach ($localizedTemplates as $localizedTemplate) {
                $toDelete[] = $localizedTemplate;
            }
        }
        $this->crud->deleteBulk($toDelete, $options);

        return new JsonResponse(null, 204);
    }