laravel validation custom error include value code example
Example 1: how to add an custom error to validater error in laravel
if (request('event') == null) {
$validator->errors()->add('event', 'Please select an event');
}
Example 2: rule::exists with custom message laravel
$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);