public function saveCircleToDatabase(Request $request) { $lat = $request->input('lat'); $lng = $request->input('lng'); $radius = $request->input('radius'); $id = $request->input('id'); $type = $request->input('type'); if ($type === 'node') { $result = Node::add($lat, $lng, $radius, $id); } else { if ($type == 'poi') { $result = Point_of_interest::add($lat, $lng, $radius, $id); } } if ($result) { return response()->json(array('status' => 1, 'message' => 'Success')); } return response()->json(array('status' => 0, 'message' => 'Error !!')); }