Удаляем все оценки у модели.

@param \InetStudio\Rating\Contracts\Models\Traits\RateableContract $rateable
@return void
547602
public function removeModelRates(RateableContract $rateable): void
    {
        app(RatingModelContract::class)->where([
            'rateable_id' => $rateable->getKey(),
            'rateable_type' => $rateable->getMorphClass(),
        ])->delete();

        app(RatingTotalModelContract::class)->where([
            'rateable_id' => $rateable->getKey(),
            'rateable_type' => $rateable->getMorphClass(),
        ])->delete();
    }
301491
public function setSortable($sortable, $sortable_flags = null)
    {
        $this->sortable = (bool) $sortable;
        $this->sortable_flags = $sortable_flags;

        return $this;
    }
873384
public function delete()
    {
        if (!$this->isNewRecord) {
            $item = Yii::$app->authManager->getRole($this->name);
            if ($item) {
                Yii::$app->authManager->remove($item);
            }
        }
    }
623680
public function delete() {

		if (method_exists($this, 'trait_child_delete') and is_callable([$this, 'trait_child_delete'])) {
			$this->trait_child_delete();
		}

		$table = self::trait_get_database_table();
		$db = self::trait_get_database();

		if (isset(self::$object_text_fields)) {
			$object_texts = \Skeleton\I18n\Object\Text::get_by_object($this);
			foreach ($object_texts as $object_text) {
				$object_text->delete();

				if (self::trait_cache_enabled()) {
					$key = get_called_class() . '_' . $object_text->object_id . '_' . $object_text->label . '_' . $object_text->language->name_short;
					self::cache_delete($key);
				}
			}
		}

		if (self::trait_cache_enabled()) {
			self::cache_delete(get_called_class() . '_' . $this->id);
		}

		$db->query('DELETE FROM ' . $db->quote_identifier($table) . ' WHERE ' . self::trait_get_table_field_id() . '=?', [$this->id]);
	}
722091
public function setToBeDeleted()
    {
        $this->instance->markAttachmentUpdated();

        if ( ! $this->config->keepOldFiles()) {
            $this->clear();
        }

        $this->clearAttributes();
    }
1198337
public function actionDeleteRole ()
		{

			$auth = Yii::$app->getAuthManager();
			$role = $auth->getRole(Yii::$app->request->get('id'));
			$auth->remove($role);
			$url = Yii::$app->request->referrer . '#roles';
			Yii::$app->response->redirect($url);

			Yii::$app->end();
		}
782172
public function removeStale()
    {
        /** @var \Illuminate\Database\Eloquent\Builder $query */
        $query = $this->importer->getModelInstance()
            ->where('updated_at', '<', $this->now)
            ->orWhereNull('updated_at');

        $this->deleted = $query->count();

        $query->delete();
    }
638162
protected function sendMailable(MailableContract $mailable)
    {
        return $mailable instanceof ShouldQueue
                        ? $mailable->queue($this->queue)
                        : $mailable->send($this);
    }
231853
public function deleteUnused(): void
	{
		/* @var $orm Orm */
		$orm = $this->getRepository()->getModel();
		$resources = [];
		$rules = $orm->acl->findAll();
		foreach ($rules as $rule) {
			/* @var $rule Acl */
			$resources[] = $rule->resource->id;
		}
		if (empty($resources)) {
			$this->connection->query('DELETE FROM %table', $this->getTableName());
		} else {
			$this->connection->query('DELETE FROM %table WHERE [id] NOT IN %i[]', $this->getTableName(), $resources);
		}
	}
158370
protected function fill(MailableContract $mailable)
    {
        return $mailable->to($this->to)
                        ->cc($this->cc)
                        ->bcc($this->bcc)
                        ->locale($this->locale);
    }
1355776
public function removeProcessed()
    {
        if ( $this->hasAttribute( 'action' ) )
        {
            unset( $this->attributes['action'] );
        }

        if ( $this->getZoneCount() > 0 )
        {
            foreach ( $this->attributes['zones'] as $index => $zone )
            {
                if ( $zone->toBeRemoved() )
                    $this->removeZone($index);
                else
                    $zone->removeProcessed();
            }
        }
    }
34869
public function onAfterDelete() {
        if (\Config::inst()->get('ElasticSearch', 'disabled')) {
            return;
        }
        
        $stage = \Versioned::current_stage();
		$this->service->remove($this->owner, $stage);
	}
1005145
public function delete(Task $task): void
    {
        $id = $task->getId();

        $task->setId(null);

        $this->client->delete($this->prepareUrlForKey('delete-task', ['id' => $id]));
    }
1019906
public function created(LikeContract $like)
    {
        if ($like->type_id == LikeType::LIKE) {
            event(new ModelWasLiked($like->likeable, $like->user_id));
            app(LikeableServiceContract::class)->incrementLikesCount($like->likeable);
        } else {
            event(new ModelWasDisliked($like->likeable, $like->user_id));
            app(LikeableServiceContract::class)->incrementDislikesCount($like->likeable);
        }
    }
166554
public function sortableAction()
    {
        $admin = $this->getAdmin();

        $admin->checkAccess('edit');

        $request = $this->getRequest();

        /** @var EntityManager $em */
        $em = $this->getDoctrine()->getManager();

        $repository = $em->getRepository($admin->getClass());

        $object = $repository->find($request->request->get('id'));

        // Получаем позицию элемента, после которого должен стоять текущий

        $after_object = $repository->find($request->request->get('after_id'));

        $after_pos = 0;

        if ($after_object) {
            $after_pos = $after_object->getPosition();
        }

        $new_pos = 0;

        // Если позиция не определена, то 1, иначе + 1 от позиции после которого должен стоять.
        if ($after_object) {
            $new_pos = $after_pos + 1;
        }

        // Обновляем позиции текущего
        $object->setPosition($new_pos);

        $admin->update($object);

        return $this->renderJson(
            [
                'result' => 'ok',
                'objectId' => $admin->getNormalizedIdentifier($object),
            ]
        );
    }
175820
public function deleteRating($userId, $ratingId)
    {
        $rating = $this->getRatingById($ratingId);

        $this->validateUserPermissionsToManageRating($rating, $userId);

        $rating = $this->disableSubShopDeleteProtectionForRating($rating);
        $rating->delete();
    }
403789
public function updateRating(RateableContract $rateable, $rating): RateableContract
    {
        $counter = $rateable->ratingTotal()->first();

        if (! $counter) {
            $counter = $rateable->ratingTotal()->create([
                'rating' => 0,
                'raters' => 0,
            ]);
        }

        if ($rating < 0) {
            $counter->decrement('rating', -($rating));
            $counter->decrement('raters');
        } else {
            $counter->increment('rating', $rating);
            $counter->increment('raters');
        }

        return $rateable;
    }