I am using the messages method to return the error messages for each of my attributes .. it happens that for each attribute it returns an array and I would like it to return a string.
In my model...
public function validate()
{
$validator = Validator::make($this->attributesToArray(), $this->validationRules);
if($validator->fails()) {
throw new \App\Exceptions\OperationNotAllowed('validation failed', $validator->messages(), '422');
}
return true;
}
In my Exception
public function render($request)
{
return response()->json([
'error' => $this->erro,
'details' => $this->details,
], $this->code);
}
Look how the result is coming out
And I wish that instead of array for each attribute the error message would be a string