Laravel Json Response Not working as expected
问题 Unable to get response while response object is empty. Works perfect when the object has data returned. public function show($id) { $associates = Associate::find_by_id($id); if(count($associates)<1) { $output = array('message' => 'No Records Found'); $status = 204; } else{ $output = array('message' => 'success','data'=>$associates); $status = 200; } return response()->json($output,$status); } There is no response when the $associate object is empty. Response when $associate is not empty: {