From 1453af5b103d9ee88c68f5f6e559a2563ea4e9ac Mon Sep 17 00:00:00 2001 From: Kris Date: Wed, 22 Nov 2023 20:06:08 +0100 Subject: [PATCH] :sparkles: add TripSource for future purposes (#2154) --- app/Enum/TripSource.php | 17 ++++++++++++++ app/Models/HafasTrip.php | 8 ++++--- .../2023_11_22_000000_add_source_to_trips.php | 23 +++++++++++++++++++ 3 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 app/Enum/TripSource.php create mode 100644 database/migrations/2023_11_22_000000_add_source_to_trips.php diff --git a/app/Enum/TripSource.php b/app/Enum/TripSource.php new file mode 100644 index 000000000..6e705d19f --- /dev/null +++ b/app/Enum/TripSource.php @@ -0,0 +1,17 @@ + UTCDateTime::class, 'arrival' => UTCDateTime::class, 'last_refreshed' => 'datetime', + 'source' => TripSource::class, ]; public function polyline(): HasOne { diff --git a/database/migrations/2023_11_22_000000_add_source_to_trips.php b/database/migrations/2023_11_22_000000_add_source_to_trips.php new file mode 100644 index 000000000..da0640c2a --- /dev/null +++ b/database/migrations/2023_11_22_000000_add_source_to_trips.php @@ -0,0 +1,23 @@ +string('source') + ->default('hafas') + ->after('delay'); + }); + } + + public function down(): void { + Schema::table('hafas_trips', static function(Blueprint $table) { + $table->dropColumn('source'); + }); + } +};