Example #1
0
 /**
  * @inheritdoc
  */
 public function rules()
 {
     $rules = parent::rules();
     $rules[] = [$this->attr, 'date', 'format' => $this->dateFormat];
     $rules[] = [$this->attr, 'filter', 'filter' => 'trim'];
     return $rules;
 }
Example #2
0
 /**
  * Правила валидации
  * @return array
  */
 public function rules()
 {
     $rules = parent::rules();
     $numberValidator = [$this->attr, 'number', 'integerOnly' => $this->integerOnly];
     if (is_numeric($this->min)) {
         $numberValidator['min'] = $this->min;
     }
     if (is_numeric($this->max)) {
         $numberValidator['max'] = $this->max;
     }
     $rules[] = $numberValidator;
     $rules[] = [$this->attr, 'filter', 'filter' => 'trim'];
     return $rules;
 }