Example #1
0
 public function makePlace($data)
 {
     $db = Model::GeoPlace();
     $odm = $db->getOdm();
     $collection = $odm->selectCollection($db->collection);
     $collection->ensureIndex(['coordinates' => '2d']);
     $lat = isAke($data, 'lat', 0);
     $lng = isAke($data, 'lng', 0);
     $data['coordinates'] = ['lng' => (double) $lng, 'lat' => (double) $lat];
     return $db->create($data)->save();
 }