We will need to add status code in to the response.
Like
public function withArray(array $array, array $headers = array()) {
if ($this->statusCode == '200') {
$array = array('code' => $this->statusCode , 'success' => TRUE) + $array;
} else {
$array = array('code' => $this->statusCode, 'success' => FALSE) + $array;
}
return response()->json($array, $this->statusCode, $headers);
}
For now, we had modified library code on "ellipsesynergie/api-response/src/Laravel/Response.php"
.
But I feel. Its not good way.
Could you please suggest me how can i add this to all response without change library code ?
Or Is there any way to add the status code from controller for final response.
Actually, we will need final response like "http://screencast.com/t/nmWF7PYU".
Please help us on this.
Thanks in advance