From dc4617c576a58b93d985667446304bd72cdbf1ca Mon Sep 17 00:00:00 2001 From: Rico van Zelst Date: Tue, 31 Oct 2023 09:19:14 +0100 Subject: [PATCH] fix: fix typo in skins database --- ...23_10_31_081816_fix_typo_championskins.php | 28 +++++++++++++++++++ database/seeders/ChampionSkinSeeder.php | 9 +++++- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 database/migrations/2023_10_31_081816_fix_typo_championskins.php diff --git a/database/migrations/2023_10_31_081816_fix_typo_championskins.php b/database/migrations/2023_10_31_081816_fix_typo_championskins.php new file mode 100644 index 0000000..a5aae58 --- /dev/null +++ b/database/migrations/2023_10_31_081816_fix_typo_championskins.php @@ -0,0 +1,28 @@ +renameColumn('raritiy', 'rarity'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('champion_skins', function (Blueprint $table) { + $table->renameColumn('rarity', 'raritiy'); + }); + } +}; diff --git a/database/seeders/ChampionSkinSeeder.php b/database/seeders/ChampionSkinSeeder.php index ff08d31..c33ac45 100644 --- a/database/seeders/ChampionSkinSeeder.php +++ b/database/seeders/ChampionSkinSeeder.php @@ -2,6 +2,7 @@ namespace Database\Seeders; +use App\Models\Champion; use Illuminate\Database\Seeder; class ChampionSkinSeeder extends Seeder @@ -11,6 +12,12 @@ class ChampionSkinSeeder extends Seeder */ public function run(): void { - // + $championDataUrl = "http://cdn.merakianalytics.com/riot/lol/resources/latest/en-US/champions.json"; + $championData = json_decode(file_get_contents($championDataUrl), true); + + foreach ($championData as $champion) { + $championId = $champion['id']; + $championExists = Champion::where('champion_id', $championId)->first(); + } } }