我正在拿todos,如果数据库有todos我返回200状态代码,但如果数据库没有todo那么我应该返回哪个状态代码?
if(!todos->isEmpty()){
return response()->json(['todos' => $todos], 200);
}
else{
return response()->json(['todos' => 'No Todos'], 404);
// OR
//return response()->json(['todos' => NULL], 404);
// OR
//return response()->json(['todos' => NULL], 200);
// OR
//return response()->json(['todos' => array()], 404);
// OR
//return response()->json(['todos' => array()], 200);
}