Fix airline mapping for aircraft #628 (#633)

This commit is contained in:
Nabeel S 2020-03-09 15:06:36 -04:00 committed by GitHub
parent 412919fe21
commit 2a03d53b3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View File

@ -5,9 +5,6 @@ namespace App\Models\Observers;
use App\Models\Aircraft;
use App\Support\ICAO;
/**
* Class AircraftObserver
*/
class AircraftObserver
{
/**
@ -17,6 +14,10 @@ class AircraftObserver
*/
public function creating(Aircraft $aircraft): void
{
if (!empty($aircraft->airport_id)) {
$aircraft->airport_id = strtoupper($aircraft->airport_id);
}
if (empty($aircraft->hex_code)) {
$aircraft->hex_code = ICAO::createHexCode();
}

View File

@ -39,7 +39,7 @@ class AircraftImporter extends BaseImporter
foreach ($rows as $row) {
$airline_id = null;
if (!empty($row->airline)) {
$airline_id = $this->idMapper->getMapping('airlines', $row->airline_id);
$airline_id = $this->idMapper->getMapping('airlines', $row->airline);
}
$subfleet = $this->getSubfleet($row->icao, $airline_id);