Delete the resource with id $id. Throw an exception if not found.

@param mixed $model
@return mixed The deleted resource
480985
public function delete($model)
    {
        $this->callBeforeListeners('destroy', [$model]);
        $this->model()->remove($model);
        $this->callAfterListeners('destroy', [$model]);
        return $model;
    }
767016
public function delete(string $id)
    {
        if ($this->can('delete')) {

            $this->flow->getLogger()->debug("Deleting Resource: $this->id => $id");

            return $this->make(
                $this->performDelete($this->id, $id)
            );
        }
        throw new \BadMethodCallException('Method '.__FUNCTION__.' does not exist');
    }
1216654
public function deleteModel($model_name, $id, Request $request)
    {
        $this->checkParams(func_get_args());
        $status = $request->ajax() ? 202 : 200;

        $model = $this->findModel($model_name, $id);
        if (empty($model->id)) {
            if ($model = $model::withTrashed()->whereId($id)->first()) {
                $relations = config('kregel.warden.models.'.$model_name.'.relations');
                foreach ($relations as $rel) {
                    $model->$rel()->forceDelete();

                    $update_event = config('kregel.warden.models.'.$model_name.'.relations.'.$rel.'.delete');
                    if ($update_event instanceof Closure) {
                        $update_event($model);
                    }
                }
                $model->forceDelete();

                return response()->json(['message' => 'Resource deleted from the system.', 'code' => $status], $status);
            }

            return response()->json(['message' => 'No resource found!', 'code' => 404], 404);
        }
        $model->delete();
        if ($request->has('_redirect')) {
            // Remove the base part of the url, and just grab the tail end of the desired redirect, that way the
            // User can't be redirected away from your website.
            return $this->returnRedirect('Successfully updated resource', $request);
        }

        return response()->json(['message' => 'Successfully deleted resource', 'code' => $status], $status);
    }
1162276
public function actionDelete( $id ) {

		$model	= $this->modelService->getById( $id );

		if( GroupService::delete( $model, $model->content ) ) {

			return AjaxUtil::generateSuccess( Yii::$app->coreMessage->getMessage( CoreGlobal::MESSAGE_REQUEST ) );
		}

		// Trigger Ajax Not Found
        return AjaxUtil::generateFailure( Yii::$app->coreMessage->getMessage( CoreGlobal::ERROR_NOT_FOUND ) );
	}
1082835
public function delete($model)
    {
        if ($this->hasNotProvided($this->condition))
            return "To prevent deleting all records you must provide at least one condition. Using where method would solve this.";

        $ids = $this->search($model);

        //If string it can't continue for retrieving models
        //Throw exception with the error.
        if (is_string($ids))
            throw new OdooException($ids);

        return $this->deleteById($model, $ids);
    }
1334882
public function deleteAction(Request $request, $id)
    {
        $this->checkAccess('DELETE', $id);
        $resource = $this->getResourceManager()->find($id);
        $this->getResourceManager()->remove($resource);
        $view = $this->view(null, \FOS\RestBundle\Util\Codes::HTTP_OK);
        return $this->handleView($view);
    }
608181
public function actionDelete($id)
{
try {
$this->findModel($id)->delete();
} catch (\Exception $e) {
$msg = (isset($e->errorInfo[2]))?$e->errorInfo[2]:$e->getMessage();
\Yii::$app->getSession()->addFlash('error', $msg);
return $this->redirect(Url::previous());
}

// TODO: improve detection
$isPivot = strstr('$id',',');
if ($isPivot == true) {
return $this->redirect(Url::previous());
} elseif (isset(\Yii::$app->session['__crudReturnUrl']) && \Yii::$app->session['__crudReturnUrl'] != '/') {
Url::remember(null);
$url = \Yii::$app->session['__crudReturnUrl'];
\Yii::$app->session['__crudReturnUrl'] = null;

return $this->redirect($url);
} else {
return $this->redirect(['index']);
}
}
806564
public function delete($id)
    {
        if ($this->hasDeleteTrait($this->modelInstance)) {
            return $this->destroy($id);
        }

        return $this->modelInstance->destroy($id);
    }
1259047
public function actionDelete($id)
    {
        $model = $this->findModel($id);
        Yii::$app->getAuthManager()->remove($model->item);
        Helper::invalidate();

        return $this->redirect(['index']);
    }
558965
public function delete(Transaction $model)
    {
        try {
            $model->delete();
        } catch(\Exception $e) {
            abort(409, 'Cannot delete record');
        }

        \Cache::tags('response')->flush();

        return $this->successJsonResponse();
    }
853855
public function actionDelete($id)
    {
        $this->findModel($id)->delete();
        MenuHelper::invalidate();

        return $this->redirect(['index']);
    }
1147229
public function delete($id)
	{
		$this->getResponse()
			->setStatusCode(Response::STATUS_CODE_200);
		
		try {
			$imageService = $this->getServiceLocator()->get('document.service.image');
			$document = $imageService->delete($id);
			$data = array(
				'status' => 'success',
				'message' => "Deleted " . $id
			);
		} catch(\Exception $e) {
			$this->getResponse()
				->setStatusCode(Response::STATUS_CODE_500);
			$data = array(
				'status' => 'danger',
				'message' => $e->getMessage() 
			);
		}
		
		return new JsonModel($data);
	}
1145035
public function delete(Model $m, $id)
    {
        if (!$m->id_field) {
            throw new Exception(['id_field of a model is not set. Unable to delete record.']);
        }

        $delete = $this->initQuery($m);
        $delete->mode('delete');
        $delete->where($m->id_field, $id);
        $m->hook('beforeDeleteQuery', [$delete]);

        try {
            $delete->execute();
        } catch (\PDOException $e) {
            throw new Exception([
                'Unable to delete due to query error',
                'query'      => $delete->getDebugQuery(false),
                'model'      => $m,
                'conditions' => $m->conditions,
            ], null, $e);
        }
    }
316405
protected function deleteResourceCallable($id)
    {
        return function () use ($id) {
            $idKey = $this->getDataModel()->getKeyName();
            $model = $this->getDataModel()->query()->where($idKey, $id)->first();

            return $model->delete();
        };
    }
418853
public function destroy(int $id)
    {
        try {
            $address = Auth::user()->findAddress($id);
        } catch(\Illuminate\Database\Eloquent\ModelNotFoundException $e) {
            return $this->respondsWithError(trans('address.errors.model_not_found'));
        }

        $address->delete();

        return $this->respondsWithSuccess('', route('addressBook.index'));
    }
276568
public function undelete($model, $id) {
		$runtime = $this->runtime[$model->alias];
		$this->softDelete($model, false);

		$data = array();
		$fields = $this->_normalizeFields($model);
		foreach ($fields as $flag => $date) {
			if (true === $runtime || $flag === $runtime) {
				$data[$flag] = false;
				if ($date) {
					$data[$date] = null;
				}
				if ($flag === $runtime) {
					break;
				}
			}
		}

		$model->create();
		$model->set($model->primaryKey, $id);
		$result = $model->save(array($model->alias => $data), false, array_keys($data));
		$this->softDelete($model, $runtime);
		return $result;
	}
38380
public function destroy($id)
    {
        $this->model = $this->model->findOrFail($id);

        $this->runChecks('destroy', $this->model->toArray());

        return $this->model->delete();
    }