wip
This commit is contained in:
		@@ -1,59 +0,0 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
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'
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    public function index()
 | 
			
		||||
    {
 | 
			
		||||
        return view('weather.index', [
 | 
			
		||||
            '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()
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        $data = Cache::remember('weather.maldives', 3600, function () {
 | 
			
		||||
            $data = [];
 | 
			
		||||
            foreach ($this->stations as $station) {
 | 
			
		||||
                $rp = new MoosunMv($station);
 | 
			
		||||
                $data[] = $rp;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return $data;
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        return $data;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -21,7 +21,9 @@ class AdhadhuFeed implements Feed
 | 
			
		||||
     */
 | 
			
		||||
    public function get(): array
 | 
			
		||||
    {
 | 
			
		||||
        $crawler = $this->client->request('GET', "https://adhadhu.com/category/News");
 | 
			
		||||
        $crawler = $this->client->request('GET', "https://adhadhu.com/category/News", [
 | 
			
		||||
            "proxy" => config('karudhaas.proxy.host')
 | 
			
		||||
          ]);
 | 
			
		||||
 | 
			
		||||
        $feeds = [];
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user