$attribute; if ( !is_array($value) ) { $model->$attribute = $this->commaReplacement( $value ); $value = $model->$attribute; } if (is_array($value)) { $this->addError($model, $attribute, $this->message); return; } $pattern = $this->integerOnly ? $this->integerPattern : $this->numberPattern; if (!preg_match($pattern, "$value")) { $this->addError($model, $attribute, $this->message); } if ($this->min !== null && $value < $this->min) { $this->addError($model, $attribute, $this->tooSmall, ['min' => $this->min]); } if ($this->max !== null && $value > $this->max) { $this->addError($model, $attribute, $this->tooBig, ['max' => $this->max]); } } protected function validateValue($value) { $value = $this->commaReplacement( $value ); return parent::validateValue( $value ); } protected function commaReplacement( $value ) { return str_replace( ',', '.', $value ); } }