mirror of
https://github.com/ZorgCC/lumen-generators.git
synced 2025-01-12 21:37:56 +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 = [])
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user