예제 #1
0
파일: Auth.php 프로젝트: wuwenhan/huoqiwang
 public function validatePermission()
 {
     if (!$this->hasErrors()) {
         $auth = \App::$app->getAuthManager();
         if ($this->isNewRecord && $auth->getPermission($this->name)) {
             $this->addError('name', \App::t('auth', 'This name already exists.'));
         }
         if ($this->isNewRecord && $auth->getRole($this->name)) {
             $this->addError('name', \App::t('auth', 'This name already exists.'));
         }
     }
 }
예제 #2
0
파일: User.php 프로젝트: wuwenhan/huoqiwang
 /**
  * @inheritdoc
  */
 public function attributeLabels()
 {
     $labels = parent::attributeLabels();
     return array_merge($labels, ['password' => \App::t('app', 'Password'), 'repassword' => \App::t('app', 'Repassword')]);
 }