I'm using this code to validate my $request variable:
$validatedData = $request->validate([
'name' => 'string|required|max:255',
'lead' => 'nullable|string',
...
]);
After this I want to return error messages as a JSON object, use this code:
return response()->json([
'errors' => $validatedData->errors()
]);
And here it says $ValidateData is an array. That's true, but where can I find the validation error messages? I checked the official Laravel 5.7 documentation, but it's not clear.
Any idea?