Replies: 1 comment
-
Hmm this feels a bit like a too niche feature, I don't think we're going to implement such a thing. You probably could create a custom validation Rule within Laravel which does this for you. It would then internally call |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Greetings.
I wanted to clarify whether it is possible to set a wrapper for an array with validation errors, since sometimes we are faced with the following situation:
From the form we receive an array of data of the following format:
['category' => ['name' = '....', ...]]
In this case, we skip the default Laravel validation class as stated in the documentation and validate directly with the Data class.
CategoryData::validateAndCreate($request->get('category'));
With this form format, we cannot separately select a field that has not passed validation, since in the error array, field keys are already stored without a wrapper in which they were received from the form
We get:
The way I would like to receive it:
The result that I would like to get can be achieved, for example, by catching the validation exception and generating the data yourself, like this:
But I'm interested in a more elegant solution, perhaps it is already provided in the package, or is planned for implementation.
Thanks
Beta Was this translation helpful? Give feedback.
All reactions