From 50c3e784835076d8f7f626044448451f2c0aedc9 Mon Sep 17 00:00:00 2001 From: Afzal Hossain Date: Fri, 20 Oct 2017 19:04:20 +0600 Subject: [PATCH] Better control over not_found and no_content response --- templates/controller/rest-actions.wnt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/templates/controller/rest-actions.wnt b/templates/controller/rest-actions.wnt index 726910e..ac0f26f 100644 --- a/templates/controller/rest-actions.wnt +++ b/templates/controller/rest-actions.wnt @@ -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); }