Fix/metar reading (#353)

* Fix reading of the METAR information for AviationWeather. Fix the DI

* StyleCI fixes
This commit is contained in:
Nabeel S
2019-08-08 14:52:34 -04:00
committed by GitHub
parent becf6c95f0
commit 5cafebe4d6
11 changed files with 121 additions and 100 deletions

View File

@@ -7,6 +7,7 @@ use App\Models\Acars;
use App\Models\Airline;
use App\Models\Pirep;
use App\Models\User;
use App\Services\AirportService;
use App\Services\AwardService;
use App\Services\DatabaseService;
use Illuminate\Database\QueryException;
@@ -55,6 +56,7 @@ class DevCommands extends Command
'db-attrs' => 'dbAttrs',
'list-awards' => 'listAwardClasses',
'manual-insert' => 'manualInsert',
'metar' => 'getMetar',
'reset-install' => 'resetInstall',
'xml-to-yaml' => 'xmlToYaml',
];
@@ -187,6 +189,19 @@ class DevCommands extends Command
$this->info('Writing yaml to storage: '.$file_name);
}
protected function getMetar(): void
{
$icao = $this->argument('param');
if (!$icao) {
$this->error('Enter an ICAO!');
exit();
}
$airportSvc = app(AirportService::class);
$metar = $airportSvc->getMetar($icao);
$this->info($metar->raw);
}
/**
* Insert the rows from the file, manually advancing each row
*/