-
Notifications
You must be signed in to change notification settings - Fork 149
Open
Description
I have the same issues as this #143 (comment)
Found this in Validation.php
Line 399 in ff003a3
| $messageKeys = [ |
As well as this
Line 420 in ff003a3
| if (isset($this->messages[$key])) { |
My fix:
- I added a new key as the first value in
$messageKeys
$messageKeys = [
'*'.$this->messageSeparator.$ruleKey, // new value
$attributeKey.$this->messageSeparator.$ruleKey,
$attributeKey,
$ruleKey
];- I added to my custom messages to match the new value
$validation = $validator->validate($data, $rules, [
'required' => ':attribute is required',
'*:unique' => ':attribute already exists', // new custom message
'email' => ':attribute must be a valid email address',
'numeric' => ':attribute must be numeric',
'in' => ':attribute must be one of :allowed_values',
]);This was the first messages it picks on (Line #421) is the custom message and it breaks the loop. The fix work for any other custom rule as long as it matches *:{$ruleKey}
It's a temporary fix and not a very good cause I had to edit files file /vendor folder. If you could look into this, I'd also be happy to create a PR if I find a better solution later on
Metadata
Metadata
Assignees
Labels
No labels