mirror of
https://github.com/ZorgCC/lumen-generators.git
synced 2025-04-16 14:12:26 +03:00
Better control over not_found and no_content response
This commit is contained in:
parent
ee03649641
commit
50c3e78483
@ -53,6 +53,12 @@ trait RESTActions {
|
|||||||
|
|
||||||
protected function respond($status, $data = [])
|
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);
|
return response()->json($data, $status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user