move user to trash
@param  int $id
@return Response
16561
public function moveToTrash($id)
    {
        $user = AppUser::find($id);

        if (!$user) {
            return response()->json(null, 404);
        }

        if (!$user->delete()) {
            return response()->json(null, 500); // @codeCoverageIgnore
        }

        return response()->json(null, 204);
    }
404391
public function deleteAction($id)
    {
        $em = $this->getDoctrine()->getManager();
        $em->remove($this->getImage($id));
        $em->flush();

        return new Response();
    }
816032
public function destroy($id)
    {
        // Get the first permission that is not this one that we are trying to delete
        $default_permission = Role::findOrFail(1);

        // Build users model based on Auth config model
        $user_model = config('auth.model');
        // Update all the users that have this role. Assign them the default role.
        $user_model::where('role_id', '=', $id)
                   ->update(['role_id' => $default_permission->id]);

        // Delete the requested role.
        $role = Role::findOrFail($id);
        $role->delete();

        return redirect()->action('\Aginev\Acl\Http\Controllers\RoleController@index')
                         ->with('success', trans('acl::role.destroy.deleted'));
    }
1032404
public function destroy($id)
    {
        try {
            $file = $this->fileDB->getById($id);
            $this->fileDB->deleteFile($file);
            return 'File deleted';
        } catch (\Exception $e) {
            \Log::error($e);
            $this->flashMessage('delete-failed','danger');
            return 'Error: File not deleted';
        }
    }
830952
public function deleteAction($id)
    {
        $targetGroup = $this->retrieveTargetGroupById($id);

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

        return $this->handleView($this->view(null, 204));
    }
1192511
public function deleteFromFlexiBee($id = null)
    {
        if (is_null($id)) {
            $id = $this->getMyKey();
        }

        $this->performRequest($this->getEvidenceUrl().'/'.self::urlizeId($id),
            'DELETE');
        return $this->lastResponseCode == 200;
    }
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'));
    }
740161
protected function moveDown($id)
    {
        $model = $this->getModel($id);
        $orderAttrName = $this->positionAttribute;
        $orderDir = SORT_ASC;

        $swapModel = $model::find()
            ->where(['>', $orderAttrName, $model->$orderAttrName])
            ->orderBy([$orderAttrName => $orderDir])
            ->one();

        if ($swapModel) {
            $newOrderNumeric = $swapModel->$orderAttrName;
            $swapModel->$orderAttrName = $model->$orderAttrName;
            $model->$orderAttrName = $newOrderNumeric;
            $swapModel->save() && $model->save();
        }

        return $this->redirect($model);
    }
21854
public function destroy($id)
    {
        $this->entriesRepository->delete($id, $this->resource);

        return response()->json(['status' => 'ok']);
    }
1367164
public function destroy($id)
    {
        // get user by id
        $user = AppUser::withTrashed()->where('id', $id)->first();

        if (!$user) {
            return response()->json(null, 404);
        }

        // delete user
        $deleteUser = $user->forceDelete();

        return response()->json(null, 204);
    }
1077235
public function destroy($id)
      {
        $user = $this->users->findOrFail($id);
        User::destroy($id);
        return \Redirect::route('admin.users.index', [
          ])->withMessage(trans('acl::user.users-controller-successfully_deleted'));
        }
1298670
public function destroy($id)
    {
        $campagne = $this->campagne->find($id);
        $campagne->content()->delete();
        
        $this->campagne->delete($id);

        alert()->success('Campagne supprimée');

        return redirect()->back();
    }
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']);
    }
879084
public function handleDelete(int $id = null)
    {
        if ($id === null) {
            if (isset($_GET['template']) === false) {
                return redirect($this->router->generate('pages-list-page') . "?m=2");
            } else {
                return 'Redirect: ' . $this->router->generate('pages-list-page') . "?m=2";
            }
        }
        $page = $this->core->api('Page/' . $id, 'DELETE')->run();
        if ($page['headers'][0][2] === 422) {
            if (isset($_GET['template']) === false) {
                return redirect($this->router->generate('pages-list-page') . "?m=2");
            } else {
                return 'Redirect: ' . $this->router->generate('pages-list-page') . "?m=2";
            }
        } elseif (($page["headers"][0][2] - 200) * ($page["headers"][0][2] - 299) > 0) {
            if (headers_sent() === false) {
                foreach ($page["headers"] as $header) {
                    header($header[0], $header[1], $header[2]);
                }
            }
            return $this->templates->render("500", [
                "error" => $page['response'],
                "result" => ''
            ]);
        }

        if (isset($_GET['template']) === false) {
            return redirect($this->router->generate('pages-list-page') . "?m=1");
        } else {
            return 'Redirect: ' . $this->router->generate('pages-list-page') . "?m=1";
        }
    }
808467
public function destroy($id)
    {
        try {
            $this->contentTypes->destroy($id);
        } catch (Exception $e) {
            return $this->handleException($e, trans('soda::errors.delete', ['object' => trans('soda::terminology.content_type')]));
        }

        return redirect()->route('soda.content-types.index')->with('warning', trans('soda::messages.deleted', ['object' => trans('soda::terminology.content_type')]));
    }
1364712
public function deleteAction($id)
    {
        $instance = $this->getManager()->find($id);
        if($instance) {
            $this->getManager()->delete($instance);
            $this->get('session')->getFlashBag()->add('success', 'Instance Redis has been deleted successfully');
        }else {
            $this->get('session')->getFlashBag()->add('error', 'This instance does not exist');
        }
        
        return new RedirectResponse($this->generateUrl('ringo_php_redmon'));
    }
846748
public function destroy($id)
    {
        $user = $this->userRepo->getById($id);

        if (!empty($user)) {
            $this->authorize('delete', $user);
            $user->delete();
            return $this->respondWithSimpleSuccess(['success' => true]);
        }
        return $this->respondNotFound();
    }