Answer the question
In order to leave comments, you need to log in
Why is the data constantly not being validated?
Model:
public function rules() {
return [
['email', 'email'],
['name', 'myRule'],
['text', 'trim'],
];
}
public function myRule ($attr)
{
if ( !in_array($this->attr, ['Ivan', 'Petr']))
{
$this->addError($attr, 'Имя должно быть "Petr" или "Ivan"');
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question