dirk94's avatar

Validation Error Messages

Hi,

I'm trying to get error messages in Lumen to work. So far I have a validator instance that checks the JSON input.

$validator = Validator::make($request->json()->all(), [ /* rules */]);
if ($validator->fails()) { 
    return response()->json($validator->errors(), 400);
}

However this returns error messages such as:

{
    "email": [
        "validation.required"
    ]
}

How can I change the validation.required to something like 'The email is required' as is the default in the Laravel framework I believe.

Thanks in advance! Dirk.

0 likes
2 replies
Goldoni's avatar

goto /ressources/lang/en/validation.php and change default message

'required'             => 'The :attribute field is required.'

Please or to participate in this conversation.