Get the correct ordering for flight route on map
This commit is contained in:
@@ -240,7 +240,7 @@ class Pirep extends BaseModel
|
|||||||
{
|
{
|
||||||
return $this->hasMany(Acars::class, 'pirep_id')
|
return $this->hasMany(Acars::class, 'pirep_id')
|
||||||
->where('type', AcarsType::FLIGHT_PATH)
|
->where('type', AcarsType::FLIGHT_PATH)
|
||||||
->orderBy('created_at', 'asc');
|
->orderBy('created_at', 'desc');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function acars_logs()
|
public function acars_logs()
|
||||||
|
|||||||
@@ -28,12 +28,18 @@ class AcarsRepository extends BaseRepository //implements CacheableInterface
|
|||||||
'type' => $type,
|
'type' => $type,
|
||||||
];
|
];
|
||||||
|
|
||||||
$order_by = 'created_at';
|
switch($type) {
|
||||||
if($type === AcarsType::ROUTE) {
|
default:
|
||||||
$order_by = 'order';
|
case AcarsType::FLIGHT_PATH:
|
||||||
|
case AcarsType::LOG:
|
||||||
|
$order_by = 'created_at';
|
||||||
|
break;
|
||||||
|
case AcarsType::ROUTE:
|
||||||
|
$order_by = 'order';
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->orderBy('order', 'asc')->findWhere($where);
|
return $this->orderBy($order_by, 'asc')->findWhere($where);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user