Example #1
0
 public function rules()
 {
     $rules = [['phone', 'trim'], ['phone', 'filter', 'filter' => function ($value) {
         return str_replace('+', '', $value);
     }], ['phone', 'string', 'min' => 11, 'max' => 12]];
     return \yii\helpers\ArrayHelper::merge(parent::rules(), $rules);
 }
Example #2
0
 public function rules()
 {
     $rules = [['password', 'trim'], ['password', 'required'], ['password', 'string', 'min' => 6, 'max' => 20], ['email', 'unique', 'targetClass' => '\\app\\models\\User']];
     return \yii\helpers\ArrayHelper::merge(parent::rules(), $rules);
 }