Ejemplo n.º 1
0
 public function get_weather($lat, $long)
 {
     $cache_key = 'weather_data' . $lat . $long;
     $return = Cache::get($cache_key);
     if (!$return) {
         $weather_data = Weather::get_weather($lat, $long);
         $return = array('today' => $weather_data['today'], 0 => $weather_data[0], 1 => $weather_data[1], 2 => $weather_data[2], 3 => $weather_data[3], 4 => $weather_data[4]);
         Cache::put($cache_key, $return, Config::get('mirror.cache_time'));
     }
     return $return;
 }
Ejemplo n.º 2
0
 /**
  * Finds the Weather model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Weather the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Weather::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Ejemplo n.º 3
0
 /**
  * Помещаем данные в таблицу
  * по новому
  */
 public function putDatasInTableNew()
 {
     $pogoda = new Weather();
     $pogoda->chas = $this->chas;
     $pogoda->date = $this->date;
     //var_dump($pogoda->date); exit;
     $pogoda->atmdavlnaurst = $this->pressure;
     $pogoda->temp = $this->temp;
     $pogoda->otnvlaz = $this->humidity;
     $pogoda->naprvetra = $this->wind_direction;
     $pogoda->scorvetra = $this->wind_speed;
     $pogoda->balobl = 0;
     $pogoda->gorvid = 0;
     $pogoda->osad24 = 0;
     $pogoda->osad12 = 0;
     $pogoda->vyspok = 0;
     $pogoda->dd = $this->d;
     $pogoda->city_id = $this->cityId;
     $pogoda->save(false);
 }