mirror of
https://github.com/rico-vz/HeimerdingerLoL.git
synced 2025-12-06 10:10:48 +01:00
fix: skip original (base) skin
This commit is contained in:
@@ -21,6 +21,12 @@ class ChampionSkinSeeder extends Seeder
|
||||
foreach ($champion['skins'] as $skin) {
|
||||
$skinId = $skin['id'];
|
||||
$skinExists = ChampionSkin::where('full_skin_id', $skinId)->first();
|
||||
|
||||
// Original is just the base skin (so, none) so we don't need to store it.
|
||||
if ($skin['name'] === "Original") {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($skin['cost'] == "Special") {
|
||||
$skin['cost'] = 99999;
|
||||
}
|
||||
@@ -46,6 +52,11 @@ class ChampionSkinSeeder extends Seeder
|
||||
'splash_artist' => $skin['splashArtist'],
|
||||
];
|
||||
|
||||
// Mundo is a special case, his skins often include his name in the skin name, so we need to remove it.
|
||||
if (strpos($skinAttributes['skin_name'], 'Mundo Dr. Mundo') !== false) {
|
||||
$skinAttributes['skin_name'] = str_replace('Mundo Dr. Mundo', 'Mundo', $skinAttributes['skin_name']);
|
||||
}
|
||||
|
||||
// Check if the skin already exists and if any attributes have changed, if so update the skin. If the skin doesn't exist, create it.
|
||||
// This is to prevent the skin data from being updated every time the seeder is run. As I'll probably run this on a cron job.
|
||||
if ($skinExists && $this->hasAttributesChanged($skinExists, $skinAttributes)) {
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace Database\Seeders;
|
||||
|
||||
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
@@ -14,5 +15,7 @@ class DatabaseSeeder extends Seeder
|
||||
{
|
||||
$this->call(ChampionSeeder::class);
|
||||
$this->call(ChampionSkinSeeder::class);
|
||||
|
||||
Log::info('Seeding complete at ' . date('Y-m-d H:i:s'));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user