-
Notifications
You must be signed in to change notification settings - Fork 297
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
Robust way to pass labels to validator #56
Comments
Form requests support the public function attributes()
{
return [
'pkg' => trans('setting.pkg_label'),
'key' => trans('setting.key_label'),
];
} so I thought, maybe it would be good idea to add ability pass the FormRequestClass, and the system could for example check if there there are attributes, and if so, try to get label from there. It could also add even more benefits.. for Example we could call But maybe there are better ways to do that :) Thanks! |
You handle those translations here: https://github.com/laravel/laravel/blob/master/resources/lang/en/validation.php#L96 |
@huglester , is it working for you now? |
This probably would work, but I am searching for a way, where, for example: Think I will need to extend your class. But thanks for helping @kristijanhusak |
You can handle that through Validator, with 3rd parameter to the |
But is there any way to integrate validation all together with this package? so basicly I specify label for forms, and it is used in validator? I have currently done that in my extension, but wanna make sure it does not exist in this package:) thanks |
No, there is no validation, and i'm not planning to add it because Laravel 5 have form requests that handle that pretty well. Only errors are shown, but that is pulled from session. |
Hello,
I am playing now with the lib. so far very good impressions.
But I can't find on how to link validation labels with labels from this package...
so for example I have this:
On the form, I see correct
Label
, but when getting validation errors (using formRequests), of course I see invalid labels.. like 'pkg' and not the translated string.Maybe you can share some ideas on this? :)
Thank you!
The text was updated successfully, but these errors were encountered: