Add alt airport to pirep tables
This commit is contained in:
@@ -73,6 +73,7 @@ class Pirep extends Model
|
||||
'route_leg',
|
||||
'dpt_airport_id',
|
||||
'arr_airport_id',
|
||||
'alt_airport_id',
|
||||
'level',
|
||||
'distance',
|
||||
'planned_distance',
|
||||
@@ -168,6 +169,8 @@ class Pirep extends Model
|
||||
if (array_key_exists('block_off_time', $this->attributes)) {
|
||||
return new Carbon($this->attributes['block_off_time']);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -180,6 +183,8 @@ class Pirep extends Model
|
||||
if (array_key_exists('block_on_time', $this->attributes)) {
|
||||
return new Carbon($this->attributes['block_on_time']);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -192,6 +197,8 @@ class Pirep extends Model
|
||||
if (array_key_exists('submitted_at', $this->attributes)) {
|
||||
return new Carbon($this->attributes['submitted_at']);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -228,7 +235,8 @@ class Pirep extends Model
|
||||
{
|
||||
if ($value instanceof Distance) {
|
||||
$this->attributes['distance'] = $value->toUnit(
|
||||
config('phpvms.internal_units.distance'));
|
||||
config('phpvms.internal_units.distance')
|
||||
);
|
||||
} else {
|
||||
$this->attributes['distance'] = $value;
|
||||
}
|
||||
@@ -361,7 +369,7 @@ class Pirep extends Model
|
||||
*
|
||||
* @param $value
|
||||
*/
|
||||
public function setFuelUsedAttribute($value)
|
||||
public function setFuelUsedAttribute($value): void
|
||||
{
|
||||
if ($value instanceof Fuel) {
|
||||
$this->attributes['fuel_used'] = $value->toUnit(
|
||||
@@ -377,7 +385,7 @@ class Pirep extends Model
|
||||
*
|
||||
* @param $value
|
||||
*/
|
||||
public function setPlannedDistanceAttribute($value)
|
||||
public function setPlannedDistanceAttribute($value): void
|
||||
{
|
||||
if ($value instanceof Distance) {
|
||||
$this->attributes['planned_distance'] = $value->toUnit(
|
||||
@@ -475,6 +483,11 @@ class Pirep extends Model
|
||||
return $this->belongsTo(Airport::class, 'arr_airport_id');
|
||||
}
|
||||
|
||||
public function alt_airport()
|
||||
{
|
||||
return $this->belongsTo(Airport::class, 'alt_airport_id');
|
||||
}
|
||||
|
||||
public function dpt_airport()
|
||||
{
|
||||
return $this->belongsTo(Airport::class, 'dpt_airport_id');
|
||||
|
||||
Reference in New Issue
Block a user