app\controllers\ConfController::findModel PHP Method

findModel() protected method

简化
protected findModel ( integer $id ) : the
$id integer
return the loaded model
    protected function findModel($id)
    {
        if (($model = Project::getConf($id)) !== null) {
            //判断是否为管理员
            if (!Group::isAuditAdmin($this->uid, $model->id)) {
                throw new \Exception(yii::t('w', 'you are not admin of project'));
            }
            return $model;
        } else {
            throw new NotFoundHttpException(yii::t('conf', 'project not exists'));
        }
    }