Validation rules
The rules are mostly the same as the ones implemented in Laravel
required
: The field must be present and not empty.required_with:other_field,another_field
: Only require that field if either other_field and another_field are not empty.required_with_all:other_field,another_field
: Only require that field if both other_field and another_field are not empty.required_without:other_field,another_field
: Only require that field if either other_field or another_field are empty.required_without_all:other_field,another_field
: Only require that field if other_field and another_field are empty.required_if:other_field,value…
: only require this field if other_field is equal to any valuerequired_unless:other_field,value…
: only require this field unless other_field is equal to any valueabsent
: The field must not be presentfile
: Field must be a valid file uploaded.active_url
: Must be a URL and the host in the URL must have a valid DNS A record.alpha
: Must contain only letters.alpha_dash
: Must contain only letters or dash.alpha_num
: Must contains only letters or numbersarray
: must be an arraybetween:x,y
: must be a number and be betweenx
andy
bool
orboolean
: must be evaluated as either true or falsecolor
: must be an hexadecimal color, eg.aaff99
confirmed
: another field named "field_confirmed" must be present and needs to have the same value as the fielddate
: must be a valid date time string according tostrtotime()
date_format:Y-m-d H:i:s
: must be a valid date time string according to the supplied formatdifferent:other_field
must have a different value than the other fielddigits:X
: must be a number and must have exactly X digitsdigits_between:X,Y
: must be a number and have between X and Y digitsemail
: must be a valid email addressin:one,two,three
: the field value must be one of the argumentsin_array:other_field
: field value must be one of the values of the other array fieldinteger
ouint
: must be an integer numberip
: must be a valid IP addressjson
: must be a valid JSON stringmax:X
: if field is an array, maximum number of elements, if it's a number, maximum allowed value, if it's a string, maximum lengthmin:X
: if field is an array, minimum number of elements, if it's a number, minimum allowed value, if it's a string, minimum lengthnot_in:array_field
: the field value must not be one of the values of the other array fieldnumeric
: must be a numberpresent
: must be present, but can be emptyregex:/abcd?/i
: must validate against the supplied regexpsame:other_field
: must have the same value as the other fieldsize:X
: if field is an array, must have exactly X elements, if it's a number must have this value, if it's a string must be of X lengthstring
: must be a stringtimezone
: must be a valid timezone nameurl
: must be a valid URLafter:2009-01-02
: must be a date and that date must be after the supplied dateafter_or_equal:2009-01-02
: must be a date and that date must be after of the same as the supplied datebefore:2009-01-02
: must be a date and that date must be before the supplied datebefore_or_equal:2009-01-02
: must be a date and that date must be before or the same as the supplied date
Filter rules
int
orinteger
transforms the field into an integerdate
transforms field into a DateTime objectdate_format:Y-m-d H:i:s
transforms field into a DateTime object using supplied formatbool
orboolean
transforms into a boolean valuestring
transforms into a string and trims whitespaces and line returns from end and start of string