-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add import that correct airport names
There was an issue with foreign characters being displayed for airports, this change will fix those characters.
- Loading branch information
1 parent
5dbfe8d
commit 11dd449
Showing
5 changed files
with
346,152 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
]); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.