Closed imageslr closed 6 years ago
I want to set my own code for a response, such as:
code
{ "status_code": 400, "code": 1100, "message": "xxxx" }
and I found there was a :code attr in config/api.php:
:code
config/api.php
'errorFormat' => [ 'message' => ':message', 'errors' => ':errors', 'code' => ':code', 'status_code' => ':status_code', 'debug' => ':debug', ]
How can I set the code? I have not found the method.
Thank you very much.
OK I see that I can use $this->respones->errorResponse(403, 'xxx', 1100). 😃 But it do costs me a lot of time to figure it out... Not find any docs online.
$this->respones->errorResponse(403, 'xxx', 1100)
Expected Behaviour
I want to set my own
code
for a response, such as:and I found there was a
:code
attr inconfig/api.php
:How can I set the code? I have not found the method.
Thank you very much.