This commit is contained in:
Mohamed jinas
2024-01-13 02:56:43 +05:00
parent 46e2e849bb
commit 9c42a55f1e
6 changed files with 12 additions and 112 deletions

View File

@@ -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;
}
}

View File

@@ -21,7 +21,9 @@ class AdhadhuFeed implements Feed
*/ */
public function get(): array 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 = []; $feeds = [];

View File

@@ -15,7 +15,6 @@
"fruitcake/laravel-cors": "^2.0", "fruitcake/laravel-cors": "^2.0",
"goldspecdigital/laravel-eloquent-uuid": "^8.0", "goldspecdigital/laravel-eloquent-uuid": "^8.0",
"guzzlehttp/guzzle": "^7.0.1", "guzzlehttp/guzzle": "^7.0.1",
"jinas/moosun": "^1.1",
"laravel/framework": "^8.0", "laravel/framework": "^8.0",
"laravel/jetstream": "^1.2", "laravel/jetstream": "^1.2",
"laravel/sanctum": "^2.6", "laravel/sanctum": "^2.6",

48
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "3e5dd0a5a9987085a71fc660d1940ded", "content-hash": "397d861160a8b5c62ed5576a8d9957f6",
"packages": [ "packages": [
{ {
"name": "asm89/stack-cors", "name": "asm89/stack-cors",
@@ -1777,50 +1777,6 @@
], ],
"time": "2020-06-13T08:05:20+00:00" "time": "2020-06-13T08:05:20+00:00"
}, },
{
"name": "jinas/moosun",
"version": "v1.1",
"source": {
"type": "git",
"url": "https://github.com/boring-dragon/MoosunMv.git",
"reference": "8a930d1650d9aaa23b3536b4e40082ba976a9189"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/boring-dragon/MoosunMv/zipball/8a930d1650d9aaa23b3536b4e40082ba976a9189",
"reference": "8a930d1650d9aaa23b3536b4e40082ba976a9189",
"shasum": ""
},
"require": {
"fabpot/goutte": "^4.0@dev",
"guzzlehttp/guzzle": "^6.0|^7.0.1"
},
"require-dev": {
"phpunit/phpunit": "^9.0@dev"
},
"type": "library",
"autoload": {
"psr-4": {
"Jinas\\Moosun\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mohamed Jinas",
"email": "j@live.mv"
}
],
"description": "Simple Interface to interact with maldives meteriology",
"support": {
"issues": "https://github.com/boring-dragon/MoosunMv/issues",
"source": "https://github.com/boring-dragon/MoosunMv/tree/v1.1"
},
"time": "2020-11-05T08:47:41+00:00"
},
{ {
"name": "laravel/fortify", "name": "laravel/fortify",
"version": "v1.7.13", "version": "v1.7.13",
@@ -10041,5 +9997,5 @@
"php": "^7.4|^8.0" "php": "^7.4|^8.0"
}, },
"platform-dev": [], "platform-dev": [],
"plugin-api-version": "2.6.0" "plugin-api-version": "2.3.0"
} }

View File

@@ -2,6 +2,10 @@
return [ return [
'proxy' => [
'host' => env('PROXY_HOST'),
],
"topic_filters" => [ "topic_filters" => [
"covid19" => [ "covid19" => [

View File

@@ -51,8 +51,6 @@ Route::get('/about', function () {
============================= =============================
*/ */
Route::get('/weather',[WeatherController::class, 'index'])->name('weather');
Route::middleware(['auth:sanctum', 'verified'])->prefix('dashboard')->namespace('Admin')->group(function() { Route::middleware(['auth:sanctum', 'verified'])->prefix('dashboard')->namespace('Admin')->group(function() {