I'm trying to create a validation error with this package. can you generate a new key for the error?
I'm not comfortable entering validation error data into the key data.
{
"success": false,
"code": 422,
"locale": "en",
"message": "validation error, please check the input form",
"data" : null,
"errors": {
"email": [
"The email field is required."
],
"password": [
"The password field is required."
]
}
}
LoginRequest.php
protected function failedValidation(Validator $validator)
{
$response = RB::asError($apiCode)->withError($validator->errors()->toArray())->withMessage($msg)->build();
throw new HttpResponseException($response);
}
or more simply by adding a key parameter to replace the key data.
withData($errors, "errors")->build();
I'm trying to create a validation error with this package. can you generate a new key for the error? I'm not comfortable entering validation error data into the key data.