If you just want to change the text, look in lang/en/validation.php,
or take a look at this tutorial on creating custom validation rules.
You are looking for:
'The field has to be :min chars long'
Reached said:
You are looking for:
'The field has to be :min chars long'
Yep but this applies to all min-validations .-(
Just imagine several fields with min-rules.
Yea, but you need to look into custom rules as pogachar mentioned.
Specifying the name of the input field that you want to make a custom message for, enables you to use the different attributes for them.
An example here (lang/en/validation.php):
'custom' => array(
'activity_title' => array(
'required' => 'Du skal vælge en aktivitet.',
'min' => 'Du skal minimum indtaste :min karakterer.',
),
),
For other developers facing the same problem, You have two options , One is to use the method described by @Reached above , Or you can declare everything in your controller as follows
$messsages = array(
'email.required'=>'You cant leave Email field empty',
'name.required'=>'You cant leave name field empty',
'name.min'=>'The field has to be :min chars long',
);
$rules = array(
'email'=>'required|unique:content',
'name'=>'required|min:3',
);
$validator = Validator::make(Input::all(), $rules,$messsages);
I hope this help.
surely it makes sense for you to tell users the same message i.e the field has to be :min char long? why would you not do this for every field?
Hi, I would like to suggest three way to change laravel default validation example in Laravel 5.5 : https://hdtuto.com/article/php-laravel-set-custom-validation-error-messages-example
I hope above link will help you lots...
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community