-
Notifications
You must be signed in to change notification settings - Fork 11.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lte/gte/gt/lt not using custom attribute labels #29441
Comments
Does it work when you use |
<input type="number" step="any" min="1" name="price[min]">
<input type="number" step="any" min="1" name="price[max]"> |
@tillkruss I'm trying to figure out if the dots are indeed the issue here so can you try with the |
I was just testing that, you're too fast. Same error:
I'll try simple fields, one moment. |
If the field has a value then I get a better message:
But if the field is empty, either as array
In my particular case, the min and max fields are nullable, because it's not a required field. |
What if you try this in your validation translation file? return [
'price' => [
'min' => 'minimum price',
'max' => 'maximum price',
],
]; |
I did try that initially, but it didn't work: return [
'attributes' => [
'price.min' => 'minimum price',
'price.max' => 'maximum price',
'price' => [
'min' => 'minimum price',
'max' => 'maximum price',
],
],
]; |
Okay, just tested this with the setup from the original comment and everything works as expected: master $ http --json POST test-app.test/foo price:='{"min":5, "max":4}' ~/Sites/test-app
HTTP/1.1 422 Unprocessable Entity
Cache-Control: no-cache, private
Connection: keep-alive
Content-Type: application/json
Date: Fri, 09 Aug 2019 11:58:09 GMT
Server: nginx/1.17.0
Set-Cookie: laravel_session=eyJpdiI6IkxFRXBTQlMxSzIwZW9WRFlCMnd4b2c9PSIsInZhbHVlIjoiRjhmVExTd29oeDc2UmQ3TGlKYmxHbm1yT05oMmNKTzFuWGRWTXNWQzZERWhUcDlWZmlLbnpsVVVqR2RBc2FXRCIsIm1hYyI6ImU1ODVhMDY2ZGQ1NjlkMDUwYjQ3ZGJhYjBhMDYyY2NmNjQwMzQ4MjJlNzdjYTVmNjg3ODA5NTJmNDU5Mzg4NmMifQ%3D%3D; expires=Fri, 09-Aug-2019 11:59:09 GMT; Max-Age=60; path=/; httponly
Transfer-Encoding: chunked
X-Powered-By: PHP/7.3.5
{
"errors": {
"price.max": [
"The maximum price must be greater than or equal 5."
]
},
"message": "The given data was invalid."
} So not sure if we're missing anything here? |
I do think the default should be |
Correct, now try it with
|
I can reproduce it now. Not sure what's going wrong here. |
Description:
When using the
lte
orgte
rules with a field, the custom attribute names aren't being used.Expected:
Actual result:
Notice that it not says:
Steps To Reproduce:
The text was updated successfully, but these errors were encountered: