Skip to content

Conversation

@ollieread
Copy link
Contributor

@ollieread ollieread commented Sep 2, 2022

This PR allows for validator messages to be nested without the dot notation.

Here's an example of the current way of providing custom messages.

[ 'attribute.rule1' => 'message1', 'attribute.rule2' => 'message2', 'attribute.rule3' => 'message3', 'attribute.rule4' => 'message4', 'attribute.rule5' => 'message5', ]

This PR makes it possible to nest the rule => message elements.

[ 'attribute' => [ 'rule1' => 'message1', 'rule2' => 'message2', 'rule3' => 'message3', 'rule4' => 'message4', 'rule5' => 'message5', ] ]

The idea is that it makes it easier to read and identify.

@nunomaduro nunomaduro changed the title Allow validator messages to use nested arrays [9.x] Allow validator messages to use nested arrays Sep 2, 2022
@taylorotwell taylorotwell merged commit 78289b4 into laravel:9.x Sep 5, 2022
@siarheipashkevich
Copy link
Contributor

@ollieread will it work for FormRequest attributes?

@ollieread
Copy link
Contributor Author

ollieread commented Sep 5, 2022

@ollieread will it work for FormRequest attributes?

@siarheipashkevich that's specifically why I created it, working for all validators was a side effect.

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

Labels

None yet

3 participants