Пример #1
0
 function beforeSave($insert)
 {
     parent::beforeSave($insert);
     if ($this->isNewRecord) {
         $this->password = SecurityHelper::generatePasswordHash($this->password);
     } else {
         //更新密码
         $this->password = SecurityHelper::generatePasswordHash($this->new_password);
     }
     return true;
 }