Change Default Validation Messages

If you want to change default validation error message for specific field and specific validation rule, just add a messages() method into your FormRequest class.

1class StoreUserRequest extends FormRequest
2{
3 public function rules()
4 {
5 return ['name' => 'required'];
6 }
7 
8 public function messages()
9 {
10 return ['name.required' => 'User name should be real name'];
11 }
12}

Like our articles?

Become a Premium Member for $129/year or $29/month
What else you will get:
  • 22 courses (477 lessons, total 38 h 20 min)
  • 2 long-form tutorials (one new every week)
  • access to project repositories
  • access to private Discord