/**
  * Creates a new Relevadores model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Relevadores();
     if ($model->load(Yii::$app->request->post())) {
         $address = urlencode($model->direccion);
         $url = "http://maps.google.com/maps/api/geocode/json?sensor=false&address=" . $address;
         $response = file_get_contents($url);
         $json = json_decode($response, true);
         if ($json['status'] == 'ZERO_RESULTS') {
             return array();
         }
         $model->latitud = json_encode($json['results'][0]['geometry']['location']['lat']);
         $model->longitud = json_encode($json['results'][0]['geometry']['location']['lng']);
         if ($model->save()) {
             return $this->redirect(['view', 'id' => $model->idRelevador]);
         }
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }