input('id'); $server = $request->input('server'); $content = $request->input('content');; $photo = $request->input('photo'); $location = $request->input('location'); if ($id) { $serverInfo = ServerInfo::find($id); } else { $serverInfo = new Campaign; } if ($server && $content) { $serverInfo->server = $server; $serverInfo->content = $content; $serverInfo->photo = $photo; $serverInfo->location = $location; $serverInfo->save(); return Response()->json([ "status" => 0, "message" => "保存成功!" ]); } else { return Response()->json([ "status" => -1, "message" => "信息不能为空!" ]); } } /** * 每页20进行分页 * @param Request $request * @return mixed */ public function list(Request $request) { $top = ServerInfo::where("location", "top")->get(); $bottom = ServerInfo::where("location", "bottom")->get(); return Response()->json([ "top" => $top, "introduce" => "服务介绍", "bottom" => $bottom ]); } }