I'm using Ardent in my Laravel project because I love its awesome model validation feature. Now I need to set human understandable attribute values in the validation error messages. I read that it can be accomplished by setting the $attributes array in the validation.php file (lang folder).
Since I'm coming from Yii I wonder if there is a way to specify the attribute name on a model basis and not globally in validation.php lang file.
For example, if I have two models, Employee and Company, both with a "name" attribute, I would like to set the display value of "name" attribute to "Employee name" and "Company name" respectively.
Give this a try. It's from the documentation on GitHub. I've never worked with Ardent, but it actually has quite good writeups on it.
Since these custom messages are defined in the Employees class, they only apply to inputs from this class. You could do the same for the Company class:
I think that should work. I don't have any way to test it however. The other option is using custom rules, such as
And defining those in Laravel's validation. But anyway, I hope that helps!