-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ add TripSource for future purposes (#2154)
- Loading branch information
1 parent
6925a70
commit 1453af5
Showing
3 changed files
with
45 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace App\Enum; | ||
|
||
enum TripSource: string | ||
{ | ||
/** | ||
* Trips created by data from DB-Rest (HAFAS Deutsche Bahn). | ||
* @see https://v5.db.transport.rest/ | ||
*/ | ||
case HAFAS = 'hafas'; | ||
|
||
/** | ||
* Trips created by the user - with manual data. | ||
*/ | ||
case USER = 'user'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
database/migrations/2023_11_22_000000_add_source_to_trips.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class extends Migration | ||
{ | ||
|
||
public function up(): void { | ||
Schema::table('hafas_trips', static function(Blueprint $table) { | ||
$table->string('source') | ||
->default('hafas') | ||
->after('delay'); | ||
}); | ||
} | ||
|
||
public function down(): void { | ||
Schema::table('hafas_trips', static function(Blueprint $table) { | ||
$table->dropColumn('source'); | ||
}); | ||
} | ||
}; |