Fix airport field row being inserted and check against airport ID
This commit is contained in:
@@ -20,6 +20,9 @@ use PhpUnitsOfMeasure\Exception\NonStringUnitName;
|
|||||||
* @property Collection fares
|
* @property Collection fares
|
||||||
* @property Collection subfleets
|
* @property Collection subfleets
|
||||||
* @property integer days
|
* @property integer days
|
||||||
|
* @property string dpt_airport_id
|
||||||
|
* @property string arr_airport_id
|
||||||
|
* @property string alt_airport_id
|
||||||
*/
|
*/
|
||||||
class Flight extends Model
|
class Flight extends Model
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -40,6 +40,12 @@ class FlightExporter extends ImportExport
|
|||||||
$ret['airline'] = $ret['airline']->icao;
|
$ret['airline'] = $ret['airline']->icao;
|
||||||
$ret['distance'] = $ret['distance']->toNumber();
|
$ret['distance'] = $ret['distance']->toNumber();
|
||||||
|
|
||||||
|
$ret['dpt_airport'] = $flight->dpt_airport_id;
|
||||||
|
$ret['arr_airport'] = $flight->arr_airport_id;
|
||||||
|
if($flight->alt_airport) {
|
||||||
|
$ret['alt_airport'] = $flight->alt_airport_id;
|
||||||
|
}
|
||||||
|
|
||||||
$ret['days'] = $this->getDays($flight);
|
$ret['days'] = $this->getDays($flight);
|
||||||
$ret['flight_type'] = FlightType::convertToCode($ret['flight_type']);
|
$ret['flight_type'] = FlightType::convertToCode($ret['flight_type']);
|
||||||
|
|
||||||
|
|||||||
@@ -169,8 +169,8 @@ class FlightImporter extends ImportExport
|
|||||||
protected function processAirport($airport)
|
protected function processAirport($airport)
|
||||||
{
|
{
|
||||||
return Airport::firstOrCreate([
|
return Airport::firstOrCreate([
|
||||||
'icao' => $airport,
|
'id' => $airport,
|
||||||
], ['name' => $airport]);
|
], ['icao' => $airport, 'name' => $airport]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user