diff --git a/app/Console/Commands/UpdateAlliances.php b/app/Console/Commands/UpdateAlliances.php index 596a645..f5375c8 100644 --- a/app/Console/Commands/UpdateAlliances.php +++ b/app/Console/Commands/UpdateAlliances.php @@ -15,16 +15,27 @@ class UpdateAlliances extends Command { public function handle() { - $time = now('UTC')->startOfMinute(); - $day = Date('Y-m-d', $time); + $day = now('UTC')->startOfMinute()->toDateString(); - if($day == '2026-12-17'){ - Airline::whereInternalName('asiana')->update(['alliance' => null]); + $schedules = [ + '2026-12-17' => [ + ['airline' => 'asiana', 'alliance' => null], + ], + '2027-12-12' => [ + ['airline' => 'philippine-airlines', 'alliance' => 'oneworld'], + ], + ]; + + if (!isset($schedules[$day])) { + return; } - if($day == '2027-12-12'){ - $oneworld = Alliance::whereInternalName('oneworld')->first(); - Airline::whereInternalName('philippine-airlines')->update(['alliance' => $oneworld->id]); + foreach ($schedules[$day] as $change) { + $allianceId = $change['alliance'] + ? Alliance::whereInternalName($change['alliance'])->value('id') + : null; + + Airline::whereInternalName($change['airline'])->update(['alliance' => $allianceId]); } } diff --git a/app/Http/Controllers/FeedController.php b/app/Http/Controllers/FeedController.php index c5681ee..7d1a65e 100644 --- a/app/Http/Controllers/FeedController.php +++ b/app/Http/Controllers/FeedController.php @@ -65,7 +65,7 @@ class FeedController extends Controller ->pluck('id'); return UserFlight::query() - ->with(['departureAirport', 'arrivalAirport', 'user']) + ->with(['departureAirport', 'departureAirport.region.country', 'arrivalAirport', 'arrivalAirport.region.country', 'user', 'airline']) ->whereIn('user_id', $followingIds) ->orderByDesc('departure_date') ->limit(100) diff --git a/app/Http/Controllers/HomePageController.php b/app/Http/Controllers/HomePageController.php index 493ca37..1fdc2ad 100644 --- a/app/Http/Controllers/HomePageController.php +++ b/app/Http/Controllers/HomePageController.php @@ -15,7 +15,7 @@ class HomePageController extends Controller { return Cache::remember('splash_flights', now()->addHours(12), function () { return UserFlight::query() - ->with(['departureAirport', 'arrivalAirport', 'user']) + ->with(['departureAirport', 'departureAirport.region.country', 'arrivalAirport', 'arrivalAirport.region.country' ,'user', 'airline']) ->whereHas('user', function ($query) { $query->whereRaw(DB::raw("settings->>'profile_privacy' is distinct from 'private'")); }) diff --git a/app/Settings/SettingsRegistry.php b/app/Settings/SettingsRegistry.php index bf379d7..4b60348 100644 --- a/app/Settings/SettingsRegistry.php +++ b/app/Settings/SettingsRegistry.php @@ -74,6 +74,13 @@ class SettingsRegistry 'category' => 'FlightsGoneBy Settings', 'default' => true, ], + [ + 'key' => 'hide_map_filters', + 'type' => 'checkbox', + 'label' => 'Hide Map Filters By Default', + 'category' => 'FlightsGoneBy Settings', + 'default' => false, + ], [ 'key' => 'hide_impossible_achievements', 'type' => 'checkbox', diff --git a/resources/js/Components/FlightsGoneBy/UserFlightContextMenu.vue b/resources/js/Components/FlightsGoneBy/UserFlightContextMenu.vue index 672096f..228df94 100644 --- a/resources/js/Components/FlightsGoneBy/UserFlightContextMenu.vue +++ b/resources/js/Components/FlightsGoneBy/UserFlightContextMenu.vue @@ -2,6 +2,7 @@ import {computed, ref} from "vue"; import {Flight, User} from "@/Types/types"; import {router} from "@inertiajs/vue3"; +import { copyToClipboard } from "@/Composables/useClipboard"; defineProps<{ profileUser: User @@ -21,6 +22,21 @@ const showDeleteDialog = computed({ set: (val) => { if (!val) flightToDelete.value = null } }) +function copyFlightToClipboard(flight: Flight) { + const dep = `${flight.departure_airport.display_code} (${flight.departure_airport.municipality})` + const arr = `${flight.arrival_airport.display_code} (${flight.arrival_airport.municipality})` + const times = `${flight.departure_time_display} → ${flight.arrival_time_display}` + const dayDiff = flight.arrival_day_difference !== 0 + ? `(${flight.arrival_day_difference > 0 ? '+' : ''}${flight.arrival_day_difference})` + : '' + const airline = flight.airline?.display_name + const aircraft = flight.aircraft?.display_name + const reg = flight.aircraft_registration ? `(${flight.aircraft_registration})` : '' + const text = `${airline} | ${dep} → ${arr} ${dayDiff} | ${times} · ${flight.departure_date_display} | ${aircraft} ${reg}` + copyToClipboard(text) +} + +