Add alt airport to pirep tables
This commit is contained in:
parent
9e55f8ecf0
commit
daffd1017f
@ -26,6 +26,7 @@ class CreatePirepTables extends Migration
|
||||
$table->char('flight_type', 1)->default(FlightType::SCHED_PAX);
|
||||
$table->string('dpt_airport_id', 4);
|
||||
$table->string('arr_airport_id', 4);
|
||||
$table->string('alt_airport_id', 4)->nullable();
|
||||
$table->unsignedInteger('level')->nullable();
|
||||
$table->unsignedDecimal('distance')->nullable();
|
||||
$table->unsignedDecimal('planned_distance')->nullable();
|
||||
|
@ -30,6 +30,7 @@ class PrefileRequest extends FormRequest
|
||||
'arr_airport_id' => 'required',
|
||||
'source_name' => 'required',
|
||||
|
||||
'alt_airport_id' => 'nullable',
|
||||
'status' => 'nullable',
|
||||
'level' => 'nullable|numeric',
|
||||
'flight_type' => 'nullable',
|
||||
|
@ -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');
|
||||
|
Loading…
Reference in New Issue
Block a user