Skip to content

[5.8] Use custom attributes in lt/lte/gt/gte rules messages - #29716

Merged
taylorotwell merged 2 commits into
laravel:5.8from
rgehan:fix-29441
Aug 24, 2019
Merged

[5.8] Use custom attributes in lt/lte/gt/gte rules messages#29716
taylorotwell merged 2 commits into
laravel:5.8from
rgehan:fix-29441

Conversation

@rgehan

@rgehan rgehan commented Aug 24, 2019

Copy link
Copy Markdown
Contributor

This PR fixes #29441

Consider these rules:

$rules = [
  'min' => 'numeric',
  'max' => 'numeric|gt:min,
];

And these custom attributes:

$customAttributes = [
  'min' => 'minimum value',
  'max' => 'maximum value',
];

With the following data:

$data = [
  'max' => 10,
];

Validation fails, with the following error message: The maximum value must be greater than min.

It completely ignored the custom attribute defined for max, and the message should be: The maximum value must be greater than minimum value.

@taylorotwell
taylorotwell merged commit 7725e7a into laravel:5.8 Aug 24, 2019
@tillkruss

Copy link
Copy Markdown
Contributor

Thanks @rgehan!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

lte/gte/gt/lt not using custom attribute labels

3 participants