framework icon indicating copy to clipboard operation
framework copied to clipboard

[Request] Set custom error messages directly from a FormRequest class

Open mfsousa opened this issue 12 years ago • 2 comments

Lets Say I have a FormRequest class like:

<?php namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class MyFormRequest extends FormRequest {

    public function rules()
    {
        return [
            'my_field' => 'rule'
        ];
    }

    public function messages()
    {
        return [
            'my_field.rule' => 'Specific error message just for this request / field /rule'
        ];
    }

    public function authorize()
    {
        return true;
    }

}

As you can see I added there a messages() method to specify any custom message that applies just to the request.

Is there any way to do that currently?

Regards, Marco

mfsousa avatar Aug 28 '14 23:08 mfsousa

Same question.

aarondfrancis avatar Sep 06 '14 22:09 aarondfrancis

Pull-Request to add this had been made.

AbbyJanke avatar Sep 07 '14 16:09 AbbyJanke