Removes the model.

@return void
543009
public function delete() {
        global $DB;

        \core_analytics\manager::check_can_manage_models();

        $this->clear();

        // Method self::clear is already clearing the current model version.
        $predictor = $this->get_predictions_processor(false);
        if ($predictor->is_ready() !== true) {
            $predictorname = \core_analytics\manager::get_predictions_processor_name($predictor);
            debugging('Prediction processor ' . $predictorname . ' is not ready to be used. Model ' .
                $this->model->id . ' could not be deleted.');
        } else {
            $predictor->delete_output_dir($this->get_output_dir(array(), true));
        }

        $DB->delete_records('analytics_models', array('id' => $this->model->id));
        $DB->delete_records('analytics_models_log', array('modelid' => $this->model->id));
    }
1174675
public function clear()
    {
        if (null !== $this->aStructureNode) {
            $this->aStructureNode->removeKstruktur($this);
        }
        if (null !== $this->aSkillRelatedBySkillId) {
            $this->aSkillRelatedBySkillId->removeKstrukturRelatedBySkillId($this);
        }
        $this->id = null;
        $this->type = null;
        $this->skill_id = null;
        $this->title = null;
        $this->alreadyInSave = false;
        $this->clearAllReferences();
        $this->resetModified();
        $this->setNew(true);
        $this->setDeleted(false);
    }
1366503
public function delete()
    {
        $this->getContext()->invokeApiPost('DATABASES', [
            'action' => 'delete',
            'select0' => $this->getDatabaseName(),
        ]);
        $this->getContext()->getContextUser()->clearCache();
    }
606102
public function remove()
    {
        $this->debug->groupCollapsed(__METHOD__);
        $name = $this->data['name'];
        $this->trashCollectFiles($this->data);
        $this->data = array();
        unset($_SESSION['form_persist'][$name]);
        if (empty($_SESSION['form_persist'])) {
            unset($_SESSION['form_persist']);
        }
        $this->debug->groupEnd();
    }
295574
public function cleanup(Model $model) {
        if ($model->id) {
            $this->resetCache($model, $model->id);
        }

        foreach ($this->_cached as $key => $value) {
            $this->deleteCache($model, $key);
        }
    }
892548
protected function deleteModels(): void
    {
        $model = app($this->modelClass);
        // determine if the model uses `SoftDeletes` trait
        $usesSoftDeletes = in_array(SoftDeletes::class, class_uses($model));

        foreach ($model->all() as $value) {
            try {
                if ($usesSoftDeletes) {
                    $value->forceDelete();
                } else {
                    $value->delete();
                }
            } catch (Exception $exception) {
                Log::warning(sprintf('Error during deleting models. Table: %s. Error: %s', $model->getTable(), $exception->getMessage()));
            }
        }
    }
1129913
public function down()
    {
        Schema::drop(Models::table('permissions'));
        Schema::drop(Models::table('assigned_roles'));
        Schema::drop(Models::table('roles'));
        Schema::drop(Models::table('abilities'));
    }
1269307
public function destroy()
    {
        $this->getGraph()->removeEdge($this);
        foreach ($this->getVertices() as $vertex) {
            $vertex->removeEdge($this);
        }
    }
873384
public function delete()
    {
        if (!$this->isNewRecord) {
            $item = Yii::$app->authManager->getRole($this->name);
            if ($item) {
                Yii::$app->authManager->remove($item);
            }
        }
    }
543982
public function destroy()
    {
        $this->values = array();
        $this->getStore()->delete($this->getId());
        $this->getIdHandler()->unsetId();
    }
912177
public function down()
    {
        Schema::drop('mediables');

        Media::all()->each(function ($media) {
            $media->delete();
        });

        Schema::drop('media');
    }
744969
public function clean()
    {
        foreach ( $this->createdObjects as $object )
        {
            $this->destroy( $object );
        }

        $this->createdObjects = array();
    }
1186126
public function delete()
    {
        if ($this->isNewRecord()) {
            throw new DeleteModelException("New models can't be deleted.");
        }

        $this->beforeDelete();
        $this->raiseEvent("BeforeDelete");

        $this->Deleted = true;
        $this->save();

        $this->afterDelete();
        $this->raiseEvent("AfterDelete");
    }
1204150
public function delete()
	{
		parent::delete();

		$item = $this->getView()->item;
		$fs = $this->getContext()->getFilesystemManager()->get( 'fs-secure' );

		foreach( $item->getListItems( 'attribute', 'hidden', 'download', false ) as $listItem )
		{
			$refItem = $listItem->getRefItem();

			if( $refItem !== null && $refItem->getCode() != '' && $fs->has( $refItem->getCode() ) ) {
				$fs->rm( $refItem->getCode() );
			}

			$item->deleteListItem( 'attribute', $listItem, $refItem );
		}
	}
1132716
public function clear()
    {
        $this->session->remove($this->getSessionKey());
        $this->session->remove($this->getSessionExtraKey());
        $this->session->remove($this->getSessionTargetPathKey());
    }
1241739
public function destroy()
	{
		imagedestroy($this->_imageResource);
		$this->graphics->destroy();
		$this->graphics = null;
		$this->textGraphics->destroy();
		$this->textGraphics = null;
	}
406875
public function actionRemove()
    {
        $username = $this->prompt('Username:', ['required' => true]);
        $user = $this->findModel($username);
        $this->log($this->repository->remove($user));
    }