I'm trying to compare if the value i'm validating is the same as the value in another field. A basic example would be a password confirmation. Is there a way to do so ?
If not, i think a nice way to implement it would be to make it available in actual rules instead of making a new one. For example the equal rule could accept a raw value like now or a reference to another field. Same with between, lengthBetween, lessThan and even why not inArray ?
To make a distinction with a raw value we could use the & character like in PHP. So if i do $v->required('foo')->lengthBetween(0, '&bar'); it would actually compare in between 0 and the value of bar field. Same for : $v->required('foo')->equals('&bar'); it'd check if it's equal to the value of bar field.
What do you think ?
I'm trying to compare if the value i'm validating is the same as the value in another field. A basic example would be a password confirmation. Is there a way to do so ?
If not, i think a nice way to implement it would be to make it available in actual rules instead of making a new one. For example the
equalrule could accept a raw value like now or a reference to another field. Same withbetween,lengthBetween,lessThanand even why notinArray?To make a distinction with a raw value we could use the
&character like in PHP. So if i do$v->required('foo')->lengthBetween(0, '&bar');it would actually compare in between 0 and the value ofbarfield. Same for :$v->required('foo')->equals('&bar');it'd check if it's equal to the value ofbarfield.What do you think ?