Skip to content

Commit

Permalink
add import that correct airport names
Browse files Browse the repository at this point in the history
There was an issue with foreign characters being displayed for airports, this change will fix those characters.
  • Loading branch information
roelgonzalez committed Apr 2, 2019
1 parent 5dbfe8d commit 11dd449
Show file tree
Hide file tree
Showing 5 changed files with 346,152 additions and 91 deletions.
53 changes: 53 additions & 0 deletions app/Console/Commands/UpdateAirportsCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php

namespace App\Console\Commands;

use App\Models\Airport;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\File;

class UpdateAirportsCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'realops:import-airports-v2';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Import airports into airports table on system database.';

/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}

/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$airports = File::get(resource_path('airports/airports-2019-04-02.json'));
$airports = json_decode($airports);

foreach ($airports as $airport) {
Airport::updateOrCreate([
'icao' => $airport->icao,
],[
'name' => $airport->name,
]);
}
}
}
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
"type": "project",
"require": {
"php": "^7.1.3",
"ext-json": "*",
"bugsnag/bugsnag-laravel": "^2.0",
"cviebrock/eloquent-sluggable": "^4.5",
"doctrine/dbal": "^2.6",
"doctrine/dbal": "^2.9",
"fideloper/proxy": "^4.0",
"hyn/multi-tenant": "5.3.*",
"laravel/framework": "5.6.*",
Expand Down
Loading

0 comments on commit 11dd449

Please sign in to comment.