Better control over not_found and no_content response

This commit is contained in:
Afzal Hossain 2017-10-20 19:04:20 +06:00 committed by GitHub
parent ee03649641
commit 50c3e78483

View File

@ -53,6 +53,12 @@ trait RESTActions {
protected function respond($status, $data = [])
{
if($status == Response::HTTP_NO_CONTENT){
return response(null,Response::HTTP_NO_CONTENT);
}
if($status == Response::HTTP_NOT_FOUND){
return response(['message'=>'resource not found'],Response::HTTP_NOT_FOUND);
}
return response()->json($data, $status);
}