app\controllers\ConfController::actionEditRelation PHP Метод

actionEditRelation() публичный Метод

项目审核管理员设置
public actionEditRelation ( $id, $type ) : string
Результат string
    public function actionEditRelation($id, $type = 0)
    {
        $group = Group::findOne($id);
        if (!$group) {
            throw new \Exception(yii::t('conf', 'relation not exists'));
        }
        $project = $this->findModel($group->project_id);
        if (!in_array($type, [Group::TYPE_ADMIN, Group::TYPE_USER])) {
            throw new \Exception(yii::t('conf', 'unknown relation type'));
        }
        $group->type = (int) $type;
        if (!$group->save()) {
            throw new \Exception(yii::t('w', 'update failed'));
        }
        $this->renderJson([]);
    }