get_metar($icao); } catch (\Exception $e) { Log::error('Error getting METAR: '.$e->getMessage(), $e->getTrace()); return ''; } if ($raw_metar !== '') { Cache::put($key, $raw_metar, $cache['time']); } return $raw_metar; } /** * Download the TAF, wrap in caching * * @param $icao * * @return string */ public function taf($icao): string { $cache = config('cache.keys.TAF_WEATHER_LOOKUP'); $key = $cache['key'].$icao; if (Cache::has($key)) { $taf = Cache::get($key); if ($taf !== '') { return $taf; } } try { $taf = $this->get_taf($icao); } catch (\Exception $e) { Log::error('Error getting TAF: '.$e->getMessage(), $e->getTrace()); return ''; } if ($taf !== '') { Cache::put($key, $taf, $cache['time']); } return $taf; } }