Level 88
You can override the render method here: https://github.com/laravel/lumen/blob/master/app/Exceptions/Handler.php
In general this is Laravel specific, but you will end up with something like this
// app/Exceptions/Handler.php
class Handler extends ExceptionHandler
{
public function render($request, Exception $exception)
{
if ($exception instanceof ValidationException) {
// Return your custom response here
// You can get all the data using $exception->errors();
}
return parent::render($request, $exception);
}
}
1 like