-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
add displayabled values support #4037
Conversation
thanks It is what I want |
I also met this demand, thanks |
That is great. the error message will be simple and easier to read. |
Nice work! |
Great work. Helped me a lot. |
能说中文不? |
可以用中文,不过作者可能看不懂啊,英文才是通用语言 |
@iarchean @Alexskywin @qufo @vandas Thanks! |
I'd just usually have my option values set to "web", " image", etc.
|
@jasonlewis yes! However, the use of multi-byte encoding characters such as China or Japan, it is not convenient. |
good job |
I would suggest just extend the Validator to do what you want. You can easily do so using the Validate::resolver method. |
ok,Thanks |
Want to re-open this to consider it further. |
@taylorotwell Thanks, in fact, in a non-English speaking countries is still a lot of demand. |
@taylorotwell Thanks! |
Admiration arises despite my incomprehension of what you said! |
*/ | ||
public function getDisplayableValue($attribute, $value) | ||
{ | ||
if (isset($this->customValues[$attribute][$value])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no method to set $customValues
like there is to set $customAttributes
(unless one extends Validator class):
Custom attributes may be set either in constructor or using setAttributeNames(array $attributes)
.
I think this cool functionality deserves similar API.
To explain: I'm not using the default key validation.values because my models attributes overlap.
May anyone help me to translate value from required_if validation rule? Thanks |
some times we need custom displayable values, especially when using multi-byte encoded text scenes. for example:
HTML:
Rule:
app/lang/en/validation.php:
Request:
Errors:
Difficult for users to understand what the number
1
isWe expect that this:
Now we can add the
values
field to theapp/lang/en/validation.php
to achieve it:Thanks!