Skip to content

Instantly share code, notes, and snippets.

@jaggy
Created March 12, 2020 01:21
Show Gist options
  • Save jaggy/3295d112abc933d3da6b0937bd9a21f5 to your computer and use it in GitHub Desktop.
Save jaggy/3295d112abc933d3da6b0937bd9a21f5 to your computer and use it in GitHub Desktop.
<?php
protected function invalidJson($request, ValidationException $exception)
{
return response()->json([
'message' => $exception->getMessage(),
'errors' => Collection::make($exception->errors())->mapWithKeys(function ($value, $key) {
return [Str::camel($key) => $value];
}),
], $exception->status);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment