diff --git a/app/Http/Controllers/WeatherController.php b/app/Http/Controllers/WeatherController.php index b9bac2d..661e052 100644 --- a/app/Http/Controllers/WeatherController.php +++ b/app/Http/Controllers/WeatherController.php @@ -4,31 +4,43 @@ namespace App\Http\Controllers; use Illuminate\Http\Request; use Jinas\Moosun\MoosunMv; +use Jinas\Moosun\ImgScraper; use Illuminate\Support\Facades\Cache; class WeatherController extends Controller { protected $stations = [ - 'Male', - 'Hanimadhoo', - 'Kahdhoo', - 'Kaadehdhoo', - 'Gan']; + 'Male', + 'Hanimadhoo', + 'Kahdhoo', + 'Kaadehdhoo', + 'Gan' + ]; public function index() { return view('weather.index', [ - 'stations' => $this->getMoosun(), + 'stations' => $this->getMoosun(), 'labels' => [ 'Male' => "މާލެ", 'Hanimadhoo' => "ހަނިމާދޫ", 'Kahdhoo' => "ކައްދޫ", 'Kaadehdhoo' => "ކާޑެއްދޫ", 'Gan' => "ގަން" - ] + ], + 'satellite_image' => $this->getSatelliteImage() ]); } + protected function getSatelliteImage() + { + return Cache::remember('weather.maldives.satellite', 3600, function () { + $image = new ImgScraper; + + return $image->satellite_image; + }); + } + protected function getMoosun() { diff --git a/resources/views/weather/index.blade.php b/resources/views/weather/index.blade.php index fc723ae..1935cd5 100644 --- a/resources/views/weather/index.blade.php +++ b/resources/views/weather/index.blade.php @@ -43,6 +43,14 @@ +

+ އެންމެ ފަހުގެ ސެޓެލައިޓް ފޮޓޯ +

+
+ +
+

Via Maldives Meteorology