luanrodriguesp's avatar

[L5] Nice Names Attributes - Validation

Hello all!

Im working on validation form, I would like to display betters names when the user get any error, for example: Actual i have: "The user_email is required" , this is better: "The Email Address is required."

In a google search I just found this way, http://blog.ign.uy/2013/set-friendly-names-for-validation-attributes-in-laravel

But is not so cool, i'm using request to validate my form!

Thank you all.

0 likes
9 replies
luanrodriguesp's avatar

So I did this...


'custom' => [
        'email_address' => [
            'required' => 'Well you need to tell us your email address :)',
        ],
    ],

but where to change in Request to use my new custom msg?

CustomRequest.php


public function rules()
    {
        return [
            'email_address'      => 'required',
        ];
    }
Shaun's avatar

@luanrodriguesp - might seem like an obvious question, but did you rename the actual text field in the view to email_address?

Nospoon's avatar

Is it actually possible to disable the automatic underscore removal? When working on an API this is not a good thing.

Please or to participate in this conversation.