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 = [];
|
||||
|
||||
|
@@ -15,7 +15,6 @@
|
||||
"fruitcake/laravel-cors": "^2.0",
|
||||
"goldspecdigital/laravel-eloquent-uuid": "^8.0",
|
||||
"guzzlehttp/guzzle": "^7.0.1",
|
||||
"jinas/moosun": "^1.1",
|
||||
"laravel/framework": "^8.0",
|
||||
"laravel/jetstream": "^1.2",
|
||||
"laravel/sanctum": "^2.6",
|
||||
|
48
composer.lock
generated
48
composer.lock
generated
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "3e5dd0a5a9987085a71fc660d1940ded",
|
||||
"content-hash": "397d861160a8b5c62ed5576a8d9957f6",
|
||||
"packages": [
|
||||
{
|
||||
"name": "asm89/stack-cors",
|
||||
@@ -1777,50 +1777,6 @@
|
||||
],
|
||||
"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",
|
||||
"version": "v1.7.13",
|
||||
@@ -10041,5 +9997,5 @@
|
||||
"php": "^7.4|^8.0"
|
||||
},
|
||||
"platform-dev": [],
|
||||
"plugin-api-version": "2.6.0"
|
||||
"plugin-api-version": "2.3.0"
|
||||
}
|
||||
|
@@ -2,6 +2,10 @@
|
||||
|
||||
return [
|
||||
|
||||
'proxy' => [
|
||||
'host' => env('PROXY_HOST'),
|
||||
],
|
||||
|
||||
"topic_filters" => [
|
||||
|
||||
"covid19" => [
|
||||
|
@@ -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() {
|
||||
|
||||
|
Reference in New Issue
Block a user