I recently upgraded to laravel 5.4 (from 5.2) to make use of the nullable
validation rule.
I have a field act_post_code
which can be either an integer
OR null
. So I provided the following rule in my Request
class.
'act_post_code' => 'integer|nullable'
In Postman using form-data
, I provide a key = act_post_code
with its value = null
.
The response I get is the following:
{
"act_post_code": [
"The act post code must be an integer."
]
}
act_post_code
nullable in your table definition? – Monolatryact_post_code
varchar(4) DEFAULT NULL, – Lubbernull
... hmm so it might be the way postman interprets null, its being taken as a string? – Lubbernull
, with no quotes around it. – Lubber