/*
Delete a variant
@param integer id
@return json (bool status, string message)
328334
public function getDeleteVariantJson($sid)
    {
        $status = false;
        $message = Lang::get('redminportal::messages.error_delete_entry');
        
        $product = Product::find($sid);
        
        // No such id
        if ($product == null) {
            return json_encode(array('status' => $status, 'message' => $message));
        }
        
        // Check if there's any order related to this product
        if (count($product->orders) > 0) {
            $message = Lang::get('redminportal::messages.error_delete_product_already_ordered');
            return json_encode(array('status' => $status, 'message' => $message));
        }
        
        // Delete the product
        $result = $product->delete();
        
        if ($result) {
            $status = true;
            $message = Lang::get('redminportal::messages.success_delete_record');
        }

        return json_encode(array('status' => $status, 'message' => $message));
    }
668043
public void deleteDataStore(final int id) {
        invoke(DATA_STORES, id,
                new RequestClosure<JsonStructure>() {
                    @Override
                    public JsonStructure call(Invocation.Builder request) {
                        Response response = request.delete();
                        if (response.getStatusInfo().getFamily() != Response.Status.Family.SUCCESSFUL) {
                            throw new ResponseParseException(DATA_STORES, id, null, null);
                        }
                        return null;
                    }
                },
                null
        );
    }
1306050
public function deletePost( $id ) {
        $response = $this->service->api( 'statuses/destroy/' . $id . '.json', 'POST' );

        return isset( $response['id'] ) && $response['id'] == $id;
    }
809512
public function delete(int $id)
    {
        return self::$curl->post(self::DELETE.self::$access_token, json_encode([
                'tag' => [
                    'id' => $id,
                ],
            ]
        ));
    }
614086
public final synchronized void removeId(long id)
	{
		if (tc.isEntryEnabled()) Tr.entry(tc, "removeId", new Long(id));

		_idMap.remove(id);

		if (tc.isEntryEnabled()) Tr.exit(tc, "removeId");
	}
753806
public function destroy($id)
    {
        if ($this->form()->destroy($id)) {
            return response()->json([
                'status'  => true,
                'message' => trans('merchant.delete_succeeded'),
            ]);
        } else {
            return response()->json([
                'status'  => false,
                'message' => trans('merchant.delete_failed'),
            ]);
        }
    }
1318810
public void deleteService(String id, boolean force) {
        try {
            if (id == null || id.isEmpty()) {
                id = selectRunningService();
            }
            final String idFinal = id;
            int input = 'Y';
            if (!force) {
                OutputStreamFormater.printValue(String.format(
                    "Do you really want to delete the connector: %s (Y/n): ", id));
                input = keyboard.read();
            }
            if ('n' != (char) input && 'N' != (char) input) {
                SecurityContext.executeWithSystemPermissions(new Callable<Object>() {
                    @Override
                    public Object call() throws Exception {
                        serviceManager.delete(idFinal);
                        return null;
                    }
                });
                OutputStreamFormater.printValue(String.format("Service: %s successfully deleted", id));
            }
        } catch (ExecutionException e) {
            e.printStackTrace();
            System.err.println("Could not delete service");
        } catch (IOException e) {
            e.printStackTrace();
            System.err.println("Unexpected Error");
        }
    }
528798
public synchronized void remove(int id) {
        if (tc.isEntryEnabled())
            SibTr.entry(tc, "remove", "" + id);
        if (tc.isEntryEnabled())
            SibTr.exit(tc, "remove", "" + id);
        map.remove(id);
    }
744716
public function deleteShift($id)
    {
        list($response, $statusCode, $httpHeader) = $this->deleteShiftWithHttpInfo ($id);
        return $response; 
    }
786268
public function delete(string $id)
    {
        $url = self::DELETE_URL.$this->access_token;
        $data = ['template_id' => $id];
        $request = json_encode($data);
        $data = $this->curl->post($url, $request);

        return $data;
    }
732870
public function delete($id)
    {
        $supported = $this->isSupported('delete');

        return (true === $supported) ? $this->makeRequest($this->endpoint.'/'.$id.'/delete', array(), 'DELETE') : $supported;
    }
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);
    }
76388
public function DeleteMsg($id,Request $request)
    {
        $msg = Ajaxis::BtDeleting('Warning!!','Would you like to remove This?','/setting/'. $id . '/delete/');

        if($request->ajax())
        {
            return $msg;
        }
    }
156287
public function delete($id)
    {
        // Set the endpoint
        $endpoint = $this->buildEndpoint();

        $endpoint .= '/' . $id;

        // Set the header
        $this->buildHttpHeader();

        // Send the request
        $client = new Client(); //GuzzleHttp\Client

        try {

            $response = $client->request('DELETE', $endpoint, [
                'headers' => $this->headers,
                'curl' => $this->setGetCurlopts(),
            ]);

        } catch (\GuzzleException $e) {
            $this->errorMessage = $e->getResponse()->getBody()->getContents();
            return false;

        } catch (\GuzzleHttp\Exception\ClientException $e) {
            $this->errorMessage = $e->getResponse()->getBody()->getContents();
            return false;
        } catch (\GuzzleHttp\Exception\ServerException $e) {
            $this->errorMessage = $e->getResponse()->getBody()->getContents();
            return false;
        }

        return $results = json_decode($response->getBody(), true);
    }
215988
public function delete(string $id = null)
    {
        $this->request->allowMethod(['post', 'delete']);
        $translation = $this->Translations->get($id);
        if ($this->Translations->delete($translation)) {
            $this->Flash->success((string)__('The translation has been deleted.'));
        } else {
            $this->Flash->error((string)__('The translation could not be deleted. Please, try again.'));
        }

        return $this->redirect(['action' => 'index']);
    }
462081
public function destroy($id)
    {
     	$package = Package::findOrfail($id);
     	$package->delete();
        return URL::to('package');
    }
451088
public function delete($id)
	{
		$this->getResponse()
			->setStatusCode(Response::STATUS_CODE_200);
		
		$request = $this->getRequest();
		$content = $request->getContent();
		$content = !empty($content) ? Json::decode($content, Json::TYPE_ARRAY) : array();
		$post = array_merge_recursive(
			$request->getPost()->toArray(),
			$content
		);
		$classifiedService = $this->getServiceLocator()->get('document.service.classified');

		$returnData = '';
		$action = strtolower($id);
		$classifiedService = $this->getServiceLocator()->get('document.service.classified');
		
		switch($action) {
			case 'bulk':
				$ids = $this->params()->fromQuery('ids', array());
				$ids = !is_array($ids) ? explode(",", $ids) : $ids;
				$success = 0;
				$error = 0;
				foreach($ids as $id) {
					try {
						$classifiedService->delete($id);		
						$success++;
					} catch(\Exception $e) {
						$error++;
					};
				}
						
				$returnData = array(
					'status' => 'success',
					'message' => 'Annunci eliminati con successo (' . $success . '/' . $error . ')'
				);
				break;
			default:
				try {
					$classifiedService->delete($id);
					$returnData = array(
						'status' => 'success',
						'message' => 'Annuncio eliminato con successo'
					);
				} catch(\Exception $e) {
					$this->getResponse()
					->setStatusCode(Response::STATUS_CODE_500);
					$returnData = array(
						'status' => 'danger',
						'message' => $e->getMessage()
					);
				}
				break;
		}

		return new JsonModel($returnData);
	}