I have a model with a validation rule like:
[['x'], 'integer'],
[['x'], 'unique'],
Now how can I add a rule like:
x < 100
or something like
x >= 100
I have a model with a validation rule like:
[['x'], 'integer'],
[['x'], 'unique'],
Now how can I add a rule like:
x < 100
or something like
x >= 100
It should be:
and
accordingly.
Read more in official docs.
You could also use the
min
attribute on number, or integer validators:There is also a
max
option.Yii2 greater than validation :
field_to must be greater than "field_from".
Field 1 : field_from
Field 2 : field_to