Added achievement data
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Airline;
|
||||
use App\Models\Alliance;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
@@ -122,11 +124,14 @@ return new class extends Migration
|
||||
$table->string('short_description')->after('internal_name');
|
||||
$table->text('long_description')->after('short_description');
|
||||
|
||||
|
||||
// Progressive tracking
|
||||
$table->boolean('progressive')->default(false)->after('long_description');
|
||||
|
||||
// Difficulty flavour text specific to this achievement
|
||||
$table->text('difficulty_description')->nullable()->after('progressive');
|
||||
$table->unsignedInteger('threshold')->nullable()->after('progressive');
|
||||
|
||||
|
||||
// Foreign keys
|
||||
$table->foreignId('achievement_category_id')
|
||||
@@ -182,6 +187,117 @@ return new class extends Migration
|
||||
|
||||
|
||||
$this->seedAchievements();
|
||||
$this->createAlliances();
|
||||
}
|
||||
|
||||
public function createAlliances(): void
|
||||
{
|
||||
Schema::create('alliances', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('internal_name')->unique();
|
||||
$table->string('name');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::table('airlines', function (Blueprint $table) {
|
||||
$table->foreignId('alliance_id')
|
||||
->nullable()
|
||||
->constrained('alliances')
|
||||
->nullOnDelete();
|
||||
});
|
||||
|
||||
DB::table('alliances')->insert([
|
||||
['internal_name' => 'skyteam', 'name' => 'SkyTeam', 'created_at' => now(), 'updated_at' => now()],
|
||||
['internal_name' => 'oneworld', 'name' => 'Oneworld', 'created_at' => now(), 'updated_at' => now()],
|
||||
['internal_name' => 'star_alliance', 'name' => 'Star Alliance', 'created_at' => now(), 'updated_at' => now()],
|
||||
['internal_name' => 'vanilla_alliance','name' => 'Vanilla Alliance', 'created_at' => now(), 'updated_at' => now()],
|
||||
]);
|
||||
|
||||
Airline::whereInternalName('xiamen-airlines')->update(['internal_name' => 'xiamen-air', 'name' => 'XiamenAir']);
|
||||
|
||||
$skyteam = Alliance::where('internal_name', 'skyteam')->first();
|
||||
$skyteamMembers = [
|
||||
'aerolineas-argentinas',
|
||||
'aeromexico',
|
||||
'air-europa',
|
||||
'air-france',
|
||||
'china-airlines',
|
||||
'china-eastern',
|
||||
'delta',
|
||||
'garuda-indonesia',
|
||||
'kenya-airways',
|
||||
'klm',
|
||||
'korean-air',
|
||||
'middle-east-airlines',
|
||||
'saudia',
|
||||
'sas',
|
||||
'tarom',
|
||||
'vietnam-airlines',
|
||||
'virgin-atlantic',
|
||||
'xiamen-air'
|
||||
];
|
||||
|
||||
$star = Alliance::where('internal_name', 'star_alliance')->first();
|
||||
$starMembers = [
|
||||
'aegean-airlines',
|
||||
'air-canada',
|
||||
'air-china',
|
||||
'air-india',
|
||||
'air-new-zealand',
|
||||
'all-nippon-airways',
|
||||
'asiana',
|
||||
'austrian',
|
||||
'avianca',
|
||||
'brussels-airlines',
|
||||
'copa-airlines',
|
||||
'croatia-airlines',
|
||||
'egyptair',
|
||||
'ethiopian-airlines',
|
||||
'eva-air',
|
||||
'ita-airways',
|
||||
'lot-polish-airlines',
|
||||
'lufthansa',
|
||||
'shenzhen-airlines',
|
||||
'singapore-airlines',
|
||||
'swiss',
|
||||
'tap-portugal',
|
||||
'thai-airways-international',
|
||||
'turkish-airlines',
|
||||
'united-airlines',
|
||||
];
|
||||
|
||||
$oneworld = Alliance::where('internal_name', 'oneworld')->first();
|
||||
$oneworldMembers = [
|
||||
'alaska-airlines',
|
||||
'american-airlines',
|
||||
'british-airways',
|
||||
'cathay-pacific',
|
||||
'fiji-airways',
|
||||
'finnair',
|
||||
'hawaiian-airlines',
|
||||
'iberia',
|
||||
'japan-airlines',
|
||||
'malaysia-airlines',
|
||||
'oman-air',
|
||||
'qantas',
|
||||
'qatar-airways',
|
||||
'royal-air-maroc',
|
||||
'royal-jordanian',
|
||||
'srilankan'
|
||||
];
|
||||
|
||||
$vanilla = Alliance::where('internal_name', 'vanilla_alliance')->first();
|
||||
$vanillaMembers = [
|
||||
'air-austral',
|
||||
'air-madagascar',
|
||||
'air-seychelles',
|
||||
'air-mauritius'
|
||||
];
|
||||
|
||||
Airline::whereIn('internal_name', $skyteamMembers)->update(['alliance_id' => $skyteam->id]);
|
||||
Airline::whereIn('internal_name', $starMembers)->update(['alliance_id' => $star->id]);
|
||||
Airline::whereIn('internal_name', $oneworldMembers)->update(['alliance_id' => $oneworld->id]);
|
||||
Airline::whereIn('internal_name', $vanillaMembers)->update(['alliance_id' => $vanilla->id]);
|
||||
}
|
||||
|
||||
private function seedAchievements(): void
|
||||
@@ -203,7 +319,6 @@ return new class extends Migration
|
||||
$funChallenges = $categories['fun_challenges'];
|
||||
|
||||
$icon = 'standard_achievement.png';
|
||||
$now = now();
|
||||
|
||||
$achievements = [
|
||||
|
||||
@@ -217,6 +332,7 @@ return new class extends Migration
|
||||
'long_description' => '',
|
||||
'icon' => $icon,
|
||||
'progressive' => false,
|
||||
'threshold' => null,
|
||||
'difficulty_description' => null,
|
||||
'achievement_category_id' => $generalFlying,
|
||||
'achievement_difficulty_id'=> $easy,
|
||||
@@ -228,6 +344,7 @@ return new class extends Migration
|
||||
'long_description' => '',
|
||||
'icon' => $icon,
|
||||
'progressive' => false,
|
||||
'threshold' => null,
|
||||
'difficulty_description' => null,
|
||||
'achievement_category_id' => $generalFlying,
|
||||
'achievement_difficulty_id'=> $easy,
|
||||
@@ -239,6 +356,7 @@ return new class extends Migration
|
||||
'long_description' => '',
|
||||
'icon' => $icon,
|
||||
'progressive' => false,
|
||||
'threshold' => null,
|
||||
'difficulty_description' => null,
|
||||
'achievement_category_id' => $generalFlying,
|
||||
'achievement_difficulty_id'=> $easy,
|
||||
@@ -249,6 +367,7 @@ return new class extends Migration
|
||||
'short_description' => 'Fly in Business Class.',
|
||||
'long_description' => '',
|
||||
'icon' => $icon,
|
||||
'threshold' => null,
|
||||
'progressive' => false,
|
||||
'difficulty_description' => null,
|
||||
'achievement_category_id' => $generalFlying,
|
||||
@@ -260,6 +379,7 @@ return new class extends Migration
|
||||
'short_description' => 'Fly in First Class.',
|
||||
'long_description' => '',
|
||||
'icon' => $icon,
|
||||
'threshold' => null,
|
||||
'progressive' => false,
|
||||
'difficulty_description' => null,
|
||||
'achievement_category_id' => $generalFlying,
|
||||
@@ -272,6 +392,7 @@ return new class extends Migration
|
||||
'long_description' => '',
|
||||
'icon' => $icon,
|
||||
'progressive' => false,
|
||||
'threshold' => null,
|
||||
'difficulty_description' => null,
|
||||
'achievement_category_id' => $generalFlying,
|
||||
'achievement_difficulty_id'=> $expensive,
|
||||
@@ -283,6 +404,7 @@ return new class extends Migration
|
||||
'long_description' => '',
|
||||
'icon' => $icon,
|
||||
'progressive' => false,
|
||||
'threshold' => null,
|
||||
'difficulty_description' => null,
|
||||
'achievement_category_id' => $generalFlying,
|
||||
'achievement_difficulty_id'=> $moderate,
|
||||
@@ -294,6 +416,7 @@ return new class extends Migration
|
||||
'long_description' => '',
|
||||
'icon' => $icon,
|
||||
'progressive' => false,
|
||||
'threshold' => null,
|
||||
'difficulty_description' => null,
|
||||
'achievement_category_id' => $generalFlying,
|
||||
'achievement_difficulty_id'=> $expensive,
|
||||
@@ -305,6 +428,7 @@ return new class extends Migration
|
||||
'long_description' => '',
|
||||
'icon' => $icon,
|
||||
'progressive' => false,
|
||||
'threshold' => null,
|
||||
'difficulty_description' => null,
|
||||
'achievement_category_id' => $generalFlying,
|
||||
'achievement_difficulty_id'=> $moderate,
|
||||
@@ -316,6 +440,7 @@ return new class extends Migration
|
||||
'long_description' => '',
|
||||
'icon' => $icon,
|
||||
'progressive' => false,
|
||||
'threshold' => null,
|
||||
'difficulty_description' => null,
|
||||
'achievement_category_id' => $generalFlying,
|
||||
'achievement_difficulty_id'=> $moderate,
|
||||
@@ -327,6 +452,7 @@ return new class extends Migration
|
||||
'long_description' => '',
|
||||
'icon' => $icon,
|
||||
'progressive' => true,
|
||||
'threshold' => 10,
|
||||
'difficulty_description' => null,
|
||||
'achievement_category_id' => $generalFlying,
|
||||
'achievement_difficulty_id'=> $easy,
|
||||
@@ -338,6 +464,7 @@ return new class extends Migration
|
||||
'long_description' => '',
|
||||
'icon' => $icon,
|
||||
'progressive' => true,
|
||||
'threshold' => 100,
|
||||
'difficulty_description' => null,
|
||||
'achievement_category_id' => $generalFlying,
|
||||
'achievement_difficulty_id'=> $moderate,
|
||||
@@ -349,6 +476,7 @@ return new class extends Migration
|
||||
'long_description' => '',
|
||||
'icon' => $icon,
|
||||
'progressive' => true,
|
||||
'threshold' => 500,
|
||||
'difficulty_description' => null,
|
||||
'achievement_category_id' => $generalFlying,
|
||||
'achievement_difficulty_id'=> $hard,
|
||||
@@ -360,6 +488,7 @@ return new class extends Migration
|
||||
'long_description' => '',
|
||||
'icon' => $icon,
|
||||
'progressive' => true,
|
||||
'threshold' => 1000,
|
||||
'difficulty_description' => null,
|
||||
'achievement_category_id' => $generalFlying,
|
||||
'achievement_difficulty_id'=> $expensive,
|
||||
@@ -375,6 +504,7 @@ return new class extends Migration
|
||||
'long_description' => '',
|
||||
'icon' => $icon,
|
||||
'progressive' => false,
|
||||
'threshold' => null,
|
||||
'difficulty_description' => null,
|
||||
'achievement_category_id' => $countriesAndContinents,
|
||||
'achievement_difficulty_id'=> $moderate,
|
||||
@@ -386,6 +516,7 @@ return new class extends Migration
|
||||
'long_description' => '',
|
||||
'icon' => $icon,
|
||||
'progressive' => false,
|
||||
'threshold' => null,
|
||||
'difficulty_description' => null,
|
||||
'achievement_category_id' => $countriesAndContinents,
|
||||
'achievement_difficulty_id'=> $easy,
|
||||
@@ -397,6 +528,7 @@ return new class extends Migration
|
||||
'long_description' => '',
|
||||
'icon' => $icon,
|
||||
'progressive' => false,
|
||||
'threshold' => null,
|
||||
'difficulty_description' => null,
|
||||
'achievement_category_id' => $countriesAndContinents,
|
||||
'achievement_difficulty_id'=> $easy,
|
||||
@@ -407,6 +539,7 @@ return new class extends Migration
|
||||
'short_description' => 'Fly to Oceania.',
|
||||
'long_description' => '',
|
||||
'icon' => $icon,
|
||||
'threshold' => null,
|
||||
'progressive' => false,
|
||||
'difficulty_description' => null,
|
||||
'achievement_category_id' => $countriesAndContinents,
|
||||
@@ -418,6 +551,7 @@ return new class extends Migration
|
||||
'short_description' => 'Fly to Antarctica.',
|
||||
'long_description' => '',
|
||||
'icon' => $icon,
|
||||
'threshold' => null,
|
||||
'progressive' => false,
|
||||
'difficulty_description' => 'Very few commercial or charter services operate to Antarctica, making this extremely difficult to pull off.',
|
||||
'achievement_category_id' => $countriesAndContinents,
|
||||
@@ -430,6 +564,7 @@ return new class extends Migration
|
||||
'long_description' => '',
|
||||
'icon' => $icon,
|
||||
'progressive' => false,
|
||||
'threshold' => null,
|
||||
'difficulty_description' => null,
|
||||
'achievement_category_id' => $countriesAndContinents,
|
||||
'achievement_difficulty_id'=> $easy,
|
||||
@@ -441,6 +576,7 @@ return new class extends Migration
|
||||
'long_description' => '',
|
||||
'icon' => $icon,
|
||||
'progressive' => false,
|
||||
'threshold' => null,
|
||||
'difficulty_description' => null,
|
||||
'achievement_category_id' => $countriesAndContinents,
|
||||
'achievement_difficulty_id'=> $easy,
|
||||
@@ -452,6 +588,7 @@ return new class extends Migration
|
||||
'long_description' => '',
|
||||
'icon' => $icon,
|
||||
'progressive' => false,
|
||||
'threshold' => null,
|
||||
'difficulty_description' => null,
|
||||
'achievement_category_id' => $countriesAndContinents,
|
||||
'achievement_difficulty_id'=> $easy,
|
||||
@@ -467,6 +604,7 @@ return new class extends Migration
|
||||
'long_description' => '',
|
||||
'icon' => $icon,
|
||||
'progressive' => false,
|
||||
'threshold' => null,
|
||||
'difficulty_description' => null,
|
||||
'achievement_category_id' => $aircraft,
|
||||
'achievement_difficulty_id'=> $easy,
|
||||
@@ -477,6 +615,7 @@ return new class extends Migration
|
||||
'short_description' => 'Fly on a helicopter.',
|
||||
'long_description' => '',
|
||||
'icon' => $icon,
|
||||
'threshold' => null,
|
||||
'progressive' => false,
|
||||
'difficulty_description' => null,
|
||||
'achievement_category_id' => $aircraft,
|
||||
@@ -488,6 +627,7 @@ return new class extends Migration
|
||||
'short_description' => 'Fly on a jet-powered aircraft.',
|
||||
'long_description' => '',
|
||||
'icon' => $icon,
|
||||
'threshold' => null,
|
||||
'progressive' => false,
|
||||
'difficulty_description' => null,
|
||||
'achievement_category_id' => $aircraft,
|
||||
@@ -499,6 +639,7 @@ return new class extends Migration
|
||||
'short_description' => 'Fly on a propeller driven aircraft.',
|
||||
'long_description' => '',
|
||||
'icon' => $icon,
|
||||
'threshold' => null,
|
||||
'progressive' => false,
|
||||
'difficulty_description' => null,
|
||||
'achievement_category_id' => $aircraft,
|
||||
@@ -512,6 +653,7 @@ return new class extends Migration
|
||||
'icon' => $icon,
|
||||
'progressive' => true,
|
||||
'difficulty_description' => 'Requires flying the 707, 717, 727, 737, 747, 757, 767, 777, and 787 — some of which are no longer in commercial service.',
|
||||
'threshold' => 9,
|
||||
'achievement_category_id' => $aircraft,
|
||||
'achievement_difficulty_id'=> $impossible,
|
||||
],
|
||||
@@ -522,6 +664,7 @@ return new class extends Migration
|
||||
'long_description' => '',
|
||||
'icon' => $icon,
|
||||
'progressive' => true,
|
||||
'threshold' => 10,
|
||||
'difficulty_description' => 'Covers the A300, A310, A318–A321, A330, A340, A350, and A380 families. You are likely going to have to go to Iran to get this one.',
|
||||
'achievement_category_id' => $aircraft,
|
||||
'achievement_difficulty_id'=> $nearImposs,
|
||||
@@ -532,6 +675,7 @@ return new class extends Migration
|
||||
'short_description' => 'Fly on a four-engine aircraft.',
|
||||
'long_description' => '',
|
||||
'icon' => $icon,
|
||||
'threshold' => null,
|
||||
'progressive' => false,
|
||||
'difficulty_description' => 'Four-engine jets are becoming increasingly rare as twin-engine widebodies dominate long-haul routes.',
|
||||
'achievement_category_id' => $aircraft,
|
||||
@@ -543,6 +687,7 @@ return new class extends Migration
|
||||
'short_description' => 'Fly on a double-decker aircraft.',
|
||||
'long_description' => '',
|
||||
'icon' => $icon,
|
||||
'threshold' => null,
|
||||
'progressive' => false,
|
||||
'difficulty_description' => 'Primarily the A380 and 747, which operate on a limited and shrinking number of routes.',
|
||||
'achievement_category_id' => $aircraft,
|
||||
@@ -554,17 +699,31 @@ return new class extends Migration
|
||||
'short_description' => 'Fly on a single-engine aircraft.',
|
||||
'long_description' => '',
|
||||
'icon' => $icon,
|
||||
'threshold' => null,
|
||||
'progressive' => false,
|
||||
'difficulty_description' => null,
|
||||
'achievement_category_id' => $aircraft,
|
||||
'achievement_difficulty_id'=> $moderate,
|
||||
],
|
||||
[
|
||||
'internal_name' => 'aircraft.twin_engine',
|
||||
'name' => 'Twinsies',
|
||||
'short_description' => 'Fly on a twin-engine aircraft.',
|
||||
'long_description' => '',
|
||||
'icon' => $icon,
|
||||
'threshold' => null,
|
||||
'progressive' => false,
|
||||
'difficulty_description' => 'Most planes in service today meet this criteria!',
|
||||
'achievement_category_id' => $aircraft,
|
||||
'achievement_difficulty_id'=> $easy,
|
||||
],
|
||||
[
|
||||
'internal_name' => 'aircraft.tri_engine',
|
||||
'name' => 'Triple Threat',
|
||||
'short_description' => 'Fly on a tri-engine aircraft.',
|
||||
'long_description' => '',
|
||||
'icon' => $icon,
|
||||
'threshold' => null,
|
||||
'progressive' => false,
|
||||
'difficulty_description' => 'Most tri-jets are out of service nowadays, and tri-props even rarer',
|
||||
'achievement_category_id' => $aircraft,
|
||||
@@ -573,9 +732,10 @@ return new class extends Migration
|
||||
[
|
||||
'internal_name' => 'aircraft.smaller_manufacturer',
|
||||
'name' => 'Break the Duopoly',
|
||||
'short_description' => 'Fly on an aircraft from a manufacturer other than Boeing or Airbus.',
|
||||
'short_description' => 'Fly on a scheduled flight on an aircraft from a manufacturer other than Boeing or Airbus.',
|
||||
'long_description' => '',
|
||||
'icon' => $icon,
|
||||
'threshold' => null,
|
||||
'progressive' => false,
|
||||
'difficulty_description' => null,
|
||||
'achievement_category_id' => $aircraft,
|
||||
@@ -592,6 +752,7 @@ return new class extends Migration
|
||||
'long_description' => '',
|
||||
'icon' => $icon,
|
||||
'progressive' => true,
|
||||
'threshold' => 18,
|
||||
'difficulty_description' => null,
|
||||
'achievement_category_id' => $airlinesAndAlliances,
|
||||
'achievement_difficulty_id'=> $hard,
|
||||
@@ -603,6 +764,7 @@ return new class extends Migration
|
||||
'long_description' => '',
|
||||
'icon' => $icon,
|
||||
'progressive' => true,
|
||||
'threshold' => 16,
|
||||
'difficulty_description' => null,
|
||||
'achievement_category_id' => $airlinesAndAlliances,
|
||||
'achievement_difficulty_id'=> $hard,
|
||||
@@ -614,6 +776,7 @@ return new class extends Migration
|
||||
'long_description' => '',
|
||||
'icon' => $icon,
|
||||
'progressive' => true,
|
||||
'threshold' => 26,
|
||||
'difficulty_description' => null,
|
||||
'achievement_category_id' => $airlinesAndAlliances,
|
||||
'achievement_difficulty_id'=> $hard,
|
||||
@@ -625,6 +788,7 @@ return new class extends Migration
|
||||
'long_description' => '',
|
||||
'icon' => $icon,
|
||||
'progressive' => true,
|
||||
'threshold' => 4,
|
||||
'difficulty_description' => null,
|
||||
'achievement_category_id' => $airlinesAndAlliances,
|
||||
'achievement_difficulty_id'=> $hard,
|
||||
@@ -640,6 +804,7 @@ return new class extends Migration
|
||||
'long_description' => '',
|
||||
'icon' => $icon,
|
||||
'progressive' => true,
|
||||
'threshold' => 26,
|
||||
'difficulty_description' => 'Some letters have very few airlines with a matching IATA code, requiring creative routing.',
|
||||
'achievement_category_id' => $funChallenges,
|
||||
'achievement_difficulty_id' => $hard,
|
||||
@@ -651,6 +816,7 @@ return new class extends Migration
|
||||
'long_description' => '',
|
||||
'icon' => $icon,
|
||||
'progressive' => true,
|
||||
'threshold' => 26,
|
||||
'difficulty_description' => 'Certain letters — particularly Q, X, and Z — have extremely limited airport coverage, making this a serious challenge.',
|
||||
'achievement_category_id' => $funChallenges,
|
||||
'achievement_difficulty_id' => $nearImposs,
|
||||
@@ -666,6 +832,7 @@ return new class extends Migration
|
||||
'long_description' => '',
|
||||
'icon' => $icon,
|
||||
'progressive' => true,
|
||||
'threshold' => 6,
|
||||
'difficulty_description' => null,
|
||||
'achievement_category_id' => $countriesAndContinents,
|
||||
'achievement_difficulty_id' => $hard,
|
||||
@@ -677,6 +844,7 @@ return new class extends Migration
|
||||
'long_description' => '',
|
||||
'icon' => $icon,
|
||||
'progressive' => true,
|
||||
'threshold' => 7,
|
||||
'difficulty_description' => 'Antarctica has no commercial scheduled service — expect a specialist charter or expedition flight.',
|
||||
'achievement_category_id' => $countriesAndContinents,
|
||||
'achievement_difficulty_id' => $nearImposs,
|
||||
@@ -689,7 +857,8 @@ return new class extends Migration
|
||||
'long_description' => '',
|
||||
'icon' => $icon,
|
||||
'progressive' => true,
|
||||
'difficulty_description' => 'There are 15 unique continent pairs (excluding Antarctica)',
|
||||
'threshold' => 21,
|
||||
'difficulty_description' => 'There are 21 unique continent pairs (excluding Antarctica)',
|
||||
'achievement_category_id' => $countriesAndContinents,
|
||||
'achievement_difficulty_id' => $hard,
|
||||
],
|
||||
@@ -700,7 +869,8 @@ return new class extends Migration
|
||||
'long_description' => '',
|
||||
'icon' => $icon,
|
||||
'progressive' => true,
|
||||
'difficulty_description' => "30 different intercontinental flights required, good luck.",
|
||||
'threshold' => 36,
|
||||
'difficulty_description' => "36 different intercontinental flights required, good luck.",
|
||||
'achievement_category_id' => $countriesAndContinents,
|
||||
'achievement_difficulty_id' => $nearImposs,
|
||||
],
|
||||
@@ -711,6 +881,8 @@ return new class extends Migration
|
||||
DB::table('achievements')->insert($achievements);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
// Reverse user_achievements
|
||||
|
||||
Reference in New Issue
Block a user