laravel-realworld-example-app icon indicating copy to clipboard operation
laravel-realworld-example-app copied to clipboard

Customizing the error format

Open eissasoubhi opened this issue 7 years ago • 1 comments
trafficstars

Hi,

I want to know where can I find the code that customizes the JSON error from

[{                                        
    "email": [                            
        "The email field is required."    
    ],                                    
    "password": [                         
        "The password field is required." 
    ]                                     
}].                                       

To

[{
    "errors": {
        "email": [
            "field is required."
        ],
        "password": [
            "field is required."
        ]
    }
}]

eissasoubhi avatar Mar 21 '18 05:03 eissasoubhi

Hi, it's a method respondError() located in App/Http/Controllers/Api/ApiController.php

SzymonDukla avatar Apr 25 '18 13:04 SzymonDukla