src/Traits/FormatsValidJsonResponses.php
public function validUnprocessableEntityJsonResponse(MessageBag $errors, $message = 'Unprocessable Entity', $redirect = null)
    {
        return response()->json(
            [
                'code' => '422',
                'message' => $message,
                'errors' => $errors,
                'redirect' => $redirect,
            ], 422, [], JSON_PRETTY_PRINT
        );
    }
public function validUnprocessableEntityJsonResponse(MessageBag $errors, $message = 'Unprocessable Entity', $redirect = null)
    {
        return response()->json(
            [
                'code' => '422',
                'message' => $message,
                'errors' => $errors,
                'redirect' => $redirect,
            ], 422, [], JSON_PRETTY_PRINT
        );
    }
public function validUnprocessableEntityJsonResponse ( MessageBag $ errors , $ message = 'Unprocessable Entity' , $ redirect = null ) { return response ( ) -> json ( [ 'code' => '422' , 'message' => $ message , 'errors' => $ errors , 'redirect' => $ redirect , ] , 422 , [ ] , JSON_PRETTY_PRINT ) ; }
Return a valid 422 Unprocessable entity json response.

@param \Illuminate\Support\MessageBag $errors   The message bag errors.
@param string                         $message  The response message.
@param string                         $redirect The redirection url.

@return \Illuminate\Http\JsonResponse
Return a valid 422 Unprocessable entity json response .