diff --git a/app/Services/GeoService.php b/app/Services/GeoService.php
index 059cf55b..b6a8c796 100644
--- a/app/Services/GeoService.php
+++ b/app/Services/GeoService.php
@@ -291,17 +291,17 @@ class GeoService extends Service
$route = new GeoJson();
//# Departure Airport
- $route->addPoint($flight->dpt_airport->lat, $flight->dpt_airport->lon, [
- 'name' => $flight->dpt_airport->icao,
- 'popup' => $flight->dpt_airport->full_name,
+ $route->addPoint(optional($flight->dpt_airport)->lat, optional($flight->dpt_airport)->lon, [
+ 'name' => $flight->dpt_airport_id,
+ 'popup' => optional($flight->dpt_airport)->full_name ?? $flight->dpt_airport_id,
'icon' => 'airport',
]);
if ($flight->route) {
$all_route_points = $this->getCoordsFromRoute(
- $flight->dpt_airport->icao,
- $flight->arr_airport->icao,
- [$flight->dpt_airport->lat, $flight->dpt_airport->lon],
+ $flight->dpt_airport_id,
+ $flight->arr_airport_id,
+ [optional($flight->dpt_airport)->lat, optional($flight->dpt_airport)->lon],
$flight->route
);
@@ -315,9 +315,9 @@ class GeoService extends Service
}
}
- $route->addPoint($flight->arr_airport->lat, $flight->arr_airport->lon, [
- 'name' => $flight->arr_airport->icao,
- 'popup' => $flight->arr_airport->full_name,
+ $route->addPoint(optional($flight->arr_airport)->lat, optional($flight->arr_airport)->lon, [
+ 'name' => $flight->arr_airport_id,
+ 'popup' => optional($flight->arr_airport)->full_name ?? $flight->arr_airport_id,
'icon' => 'airport',
]);
@@ -342,9 +342,9 @@ class GeoService extends Service
/*
* PLANNED ROUTE
*/
- $planned->addPoint($pirep->dpt_airport->lat, $pirep->dpt_airport->lon, [
- 'name' => $pirep->dpt_airport->icao,
- 'popup' => $pirep->dpt_airport->full_name,
+ $planned->addPoint(optional($pirep->dpt_airport)->lat, optional($pirep->dpt_airport)->lon, [
+ 'name' => $pirep->dpt_airport_id,
+ 'popup' => optional($pirep->dpt_airport)->full_name ?? $pirep->dpt_airport_id,
]);
$planned_route = $this->acarsRepo->forPirep($pirep->id, AcarsType::ROUTE);
@@ -355,9 +355,9 @@ class GeoService extends Service
]);
}
- $planned->addPoint($pirep->arr_airport->lat, $pirep->arr_airport->lon, [
- 'name' => $pirep->arr_airport->icao,
- 'popup' => $pirep->arr_airport->full_name,
+ $planned->addPoint(optional($pirep->arr_airport)->lat, optional($pirep->arr_airport)->lon, [
+ 'name' => $pirep->arr_airport_id,
+ 'popup' => optional($pirep->arr_airport)->full_name ?? $pirep->arr_airport_id,
'icon' => 'airport',
]);
diff --git a/resources/views/admin/flights/show_fields.blade.php b/resources/views/admin/flights/show_fields.blade.php
index c51a6741..d1af212c 100644
--- a/resources/views/admin/flights/show_fields.blade.php
+++ b/resources/views/admin/flights/show_fields.blade.php
@@ -5,7 +5,7 @@
{{ Form::label('dpt_airport_id', 'Dep ICAO') }}
- {{ $flight->dpt_airport->icao }} - {{ $flight->dpt_airport->name }}
+ {{ $flight->dpt_airport_id }} - {{ optional($flight->dpt_airport)->name }}
@@ -17,7 +17,7 @@
{{ Form::label('arr_airport_id', 'Arrival ICAO') }}
- {{ $flight->arr_airport->icao }} - {{ $flight->arr_airport->name }}
+ {{ $flight->arr_airport_id }} - {{ optional($flight->arr_airport)->name }}
@@ -43,7 +43,7 @@
@if($flight->alt_airport_id)
@endif
diff --git a/resources/views/admin/flights/table.blade.php b/resources/views/admin/flights/table.blade.php
index cafcff1f..9ad961fd 100644
--- a/resources/views/admin/flights/table.blade.php
+++ b/resources/views/admin/flights/table.blade.php
@@ -19,11 +19,11 @@
{{$flight->ident}}
- {{ $flight->dpt_airport->icao }}
+ {{ $flight->dpt_airport_id }}
- {{ $flight->arr_airport->icao }}
+ {{ $flight->arr_airport_id }}
@if($flight->alt_airport)
- (Alt: {{ $flight->alt_airport->icao }})
+ (Alt: {{ $flight->alt_airport_id }})
@endif
{{--{{ $flight->route }} --}}
diff --git a/resources/views/layouts/default/airports/show.blade.php b/resources/views/layouts/default/airports/show.blade.php
index 59dba4ba..7874be90 100644
--- a/resources/views/layouts/default/airports/show.blade.php
+++ b/resources/views/layouts/default/airports/show.blade.php
@@ -58,9 +58,9 @@
{{ $flight->ident }}
- {{ $flight->dpt_airport->name }}
+ {{ optional($flight->dpt_airport)->name }}
({{$flight->dpt_airport->icao}} )
+ ['id' => $flight->dpt_airport_id])}}">{{$flight->dpt_airport_id}})
{{ $flight->dpt_time }}
{{ $flight->arr_time }}
diff --git a/resources/views/layouts/default/flights/show.blade.php b/resources/views/layouts/default/flights/show.blade.php
index 0677e062..62674f0d 100644
--- a/resources/views/layouts/default/flights/show.blade.php
+++ b/resources/views/layouts/default/flights/show.blade.php
@@ -15,10 +15,10 @@
@lang('common.departure')
- {{ $flight->dpt_airport->name }}
+ {{ optional($flight->dpt_airport)->name ?? $flight->dpt_airport_id }}
({{$flight->dpt_airport->icao}} )
+ 'id' => $flight->dpt_airport_id
+ ])}}">{{$flight->dpt_airport_id}})
@ {{ $flight->dpt_time }}
@@ -26,20 +26,20 @@
@lang('common.arrival')
- {{ $flight->arr_airport->name }}
+ {{ optional($flight->arr_airport)->name ?? $flight->arr_airport_id }}
({{$flight->arr_airport->icao}} )
+ 'id' => $flight->arr_airport_id
+ ])}}">{{$flight->arr_airport_id }})
@ {{ $flight->arr_time }}
@if($flight->alt_airport_id)
@lang('flights.alternateairport')
- {{ $flight->alt_airport->name }}
+ {{ optional($flight->alt_airport)->name ?? $flight->alt_airport_id }}
({{$flight->alt_airport->icao}} )
+ 'id' => $flight->alt_airport_id
+ ])}}">{{$flight->alt_airport_id}})
@endif
diff --git a/resources/views/layouts/default/flights/table.blade.php b/resources/views/layouts/default/flights/table.blade.php
index 3a20885a..1d1be5c4 100644
--- a/resources/views/layouts/default/flights/table.blade.php
+++ b/resources/views/layouts/default/flights/table.blade.php
@@ -17,7 +17,7 @@
"x-saved-class" is the class to add/remove if the bid exists or not
If you change it, remember to change it in the in-array line as well
--}}
- @if (!setting('pilots.only_flights_from_current') || $flight->dpt_airport->icao == Auth::user()->current_airport->icao)
+ @if (!setting('pilots.only_flights_from_current') || $flight->dpt_airport_id == Auth::user()->current_airport->icao)
{{----}}
{{ strtoupper(__('flights.dep')) }}
- {{ $flight->dpt_airport->name }}
+ {{ optional($flight->dpt_airport)->name ?? $flight->dpt_airport_id }}
({{$flight->dpt_airport->icao}} )
+ 'id' => $flight->dpt_airport_id
+ ])}}">{{$flight->dpt_airport_id}})
@if($flight->dpt_time), {{ $flight->dpt_time }}@endif
{{ strtoupper(__('flights.arr')) }}
- {{ $flight->arr_airport->name }}
+ {{ optional($flight->arr_airport)->name ?? $flight->arr_airport_id }}
({{$flight->arr_airport->icao}} )
+ 'id' => $flight->arr_airport_id
+ ])}}">{{$flight->arr_airport_id}})
@if($flight->arr_time), {{ $flight->arr_time }}@endif
@if($flight->distance)