Whether the category can be deleted
@return boolean
183587
protected function canDeleteCategory()
    {
        return isset($this->data_category['category_id'])
            && $this->category->canDelete($this->data_category['category_id'])
            && $this->access('category_delete');
    }
512948
public function isDeletable() {
		
		$inverseForeignKeys = $this->db->getInverseForeignKeys(static::TABLE_NAME);
		
		foreach ($inverseForeignKeys as $r) {
			
			// only if restrict it could be not deletable
			if ('RESTRICT' != $r->DELETE_RULE) continue;
			
			// get the property name
			$propertyName = $this->getMappedProperty($r->REFERENCED_COLUMN_NAME);
			
			return !$this->checkRecordExists($r->TABLE_NAME, $r->COLUMN_NAME, $this->$propertyName);
			
		}
		
		// nothing found, is deletable
		return TRUE;
		
	}
84218
public function canDelete($member=null) {
        $parentResult=parent::canDelete($member);
        
        if($parentResult==false || $this->UserLanguage==false) {
            return false;
        }
        
        if($this->Folders()->count()>0 || $this->Snippets()->count()>0) {
            return false;
        }
        
        return true;
    }
262883
public function delete()
	{
		$query = $this->getDeleteQuery();

		$query->where($this->morphType, $this->getAttribute($this->morphType));

		return $query->delete();
	}
999923
public function matchCategory($category)
    {
        $result = empty($this->categories);
        foreach ($this->categories as $allowedCategory) {
            if ($this->categoryContains($allowedCategory, $category)) {
                $result = true;
            }
        }
        foreach ($this->exceptions as $deniedCategory) {
            if ($this->categoryContains($deniedCategory, $category)) {
                $result = false;
            }
        }

        return $result;
    }
493226
public function delete()
    {
        if (empty($this->id)) {
            $this->id = shmop_open($this->key, $this->mode, $this->permission, $this->size);
        }
        @shmop_delete($this->id);
        @shmop_close($this->id);

        return true;

    }
1063361
public static function delete_categories($categories) {
        global $CFG, $DB;
        require_once($CFG->dirroot . "/course/lib.php");

        // Validate parameters.
        $params = self::validate_parameters(self::delete_categories_parameters(), array('categories' => $categories));

        $transaction = $DB->start_delegated_transaction();

        foreach ($params['categories'] as $category) {
            $deletecat = core_course_category::get($category['id'], MUST_EXIST);
            $context = context_coursecat::instance($deletecat->id);
            require_capability('moodle/category:manage', $context);
            self::validate_context($context);
            self::validate_context(get_category_or_system_context($deletecat->parent));

            if ($category['recursive']) {
                // If recursive was specified, then we recursively delete the category's contents.
                if ($deletecat->can_delete_full()) {
                    $deletecat->delete_full(false);
                } else {
                    throw new moodle_exception('youcannotdeletecategory', '', '', $deletecat->get_formatted_name());
                }
            } else {
                // In this situation, we don't delete the category's contents, we either move it to newparent or parent.
                // If the parent is the root, moving is not supported (because a course must always be inside a category).
                // We must move to an existing category.
                if (!empty($category['newparent'])) {
                    $newparentcat = core_course_category::get($category['newparent']);
                } else {
                    $newparentcat = core_course_category::get($deletecat->parent);
                }

                // This operation is not allowed. We must move contents to an existing category.
                if (!$newparentcat->id) {
                    throw new moodle_exception('movecatcontentstoroot');
                }

                self::validate_context(context_coursecat::instance($newparentcat->id));
                if ($deletecat->can_move_content_to($newparentcat->id)) {
                    $deletecat->delete_move($newparentcat->id, false);
                } else {
                    throw new moodle_exception('youcannotdeletecategory', '', '', $deletecat->get_formatted_name());
                }
            }
        }

        $transaction->allow_commit();
    }
1061213
public function hasCategory()
    {
        $postType = getPostType($this->getTable());
        return ($postType->hasCategories && isset($this->categories) && !$this->categories->isEmpty());
    }
737369
public function delete()
    {
        $this->getLogger()->info('Deleting Campaign ID ' . $this->campaignId);
        $this->doDelete($this->url . '/' . $this->campaignId);

        return true;
    }
915896
public function destroy(Category $category)
    {
        $this->category->destroy($category);

        return redirect()->route('admin.product.category.index')
            ->withSuccess(trans('core::core.messages.resource deleted', ['name' => trans('product::categories.title.categories')]));
    }
1167479
protected function canDeleteFile()
    {
        return isset($this->data_file['file_id'])
            && $this->access('file_delete')
            && $this->file->canDelete($this->data_file['file_id']);
    }
398841
public function deleteRow()
    {
        $this->getLogger()->info('Deleting row ID ' . $this->rowId . ' From dataSet ID ' . $this->dataSetId);
        $this->doDelete('/dataset/data/' . $this->dataSetId . $this->rowId);
        
        return true;
    }
431387
public function destroy(Category $category)
    {
        $category->delete();

        return intend([
            'url' => route('adminarea.categories.index'),
            'with' => ['warning' => trans('cortex/foundation::messages.resource_deleted', ['resource' => trans('cortex/categories::common.category'), 'identifier' => $category->name])],
        ]);
    }
1079689
public function destroy(CategoryRequest $request, Category $category)
    {
        try {

            $category->delete();
            return $this->response->message(trans('messages.success.deleted', ['Module' => trans('faq::category.name')]))
                ->code(202)
                ->status('success')
                ->url(guard_url('faq/category/0'))
                ->redirect();

        } catch (Exception $e) {

            return $this->response->message($e->getMessage())
                ->code(400)
                ->status('error')
                ->url(guard_url('faq/category/' . $category->getRouteKey()))
                ->redirect();
        }

    }
1121724
public function delete() {
        global $DB;
        $DB->delete_records('portfolio_instance_config', array('instance' => $this->get('id')));
        $DB->delete_records('portfolio_instance_user', array('instance' => $this->get('id')));
        $DB->delete_records('portfolio_tempdata', array('instance' => $this->get('id')));
        $DB->delete_records('portfolio_instance', array('id' => $this->get('id')));
        $this->dirty = false;
        return true;
    }
784909
def can_remove(self):
        '''
        
        '''
        dirbase = self.app.config["directory_remove"]
        return bool(dirbase and check_under_base(self.path, dirbase))
784652
public function isDeletable(): bool {
		
		$app = Application::getInstance();
		
		if ($this->id == $app->currentUser->id) {
			return FALSE;
		}
		
		return parent::isDeletable();
		
	}