<?php

namespace common\services;

use common\components\AjaxException;
use common\models\AccidentCasesScoreComment;
use Exception;
use yii\db\ActiveQuery;

class AccidentCasesScoreCommentService
{
    /**
     * @param $id
     * @return AccidentCasesScoreComment
     * @throws AjaxException
     */
    public static function getById($id): AccidentCasesScoreComment
    {
        /** @var AccidentCasesScoreComment $Rules */
        $Rules = self::getQuery()->andWhere(["id" => $id])->one();
        if (!$Rules) {
            throw new AjaxException("该评价用语不存在！");
        }
        return $Rules;
    }

    /**
     * @return ActiveQuery
     */
    public static function getQuery(): ActiveQuery
    {
        return AccidentCasesScoreComment::find()->where(["delete_time" => 0]);
    }

    public function add()
    {

    }

    public function update()
    {

    }


}