mirror of
https://github.com/rico-vz/HeimerdingerLoL.git
synced 2026-03-21 21:12:43 +01:00
feat: implement boris
This commit is contained in:
@@ -7,11 +7,33 @@ use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
private function indexExists(string $table, string $indexName): bool
|
||||
{
|
||||
return match (DB::getDriverName()) {
|
||||
'sqlite' => $this->sqliteIndexExists($table, $indexName),
|
||||
default => $this->mysqlIndexExists($table, $indexName),
|
||||
};
|
||||
}
|
||||
|
||||
private function mysqlIndexExists(string $table, string $indexName): bool
|
||||
{
|
||||
$result = DB::select("SHOW INDEX FROM {$table} WHERE Key_name = ?", [$indexName]);
|
||||
|
||||
return count($result) > 0;
|
||||
}
|
||||
|
||||
private function sqliteIndexExists(string $table, string $indexName): bool
|
||||
{
|
||||
$indexes = DB::select("PRAGMA index_list('{$table}')");
|
||||
|
||||
foreach ($indexes as $index) {
|
||||
if (($index->name ?? null) === $indexName) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('champion_skins', function (Blueprint $table) {
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace Database\Seeders;
|
||||
|
||||
use App\Models\Champion;
|
||||
use App\Models\ChampionRoles;
|
||||
use App\Services\BorisStaticDataClient;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
@@ -15,8 +16,7 @@ class ChampionRolesSeeder extends Seeder
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$roleDataUrl = 'https://cdn.merakianalytics.com/riot/lol/resources/latest/en-US/championrates.json';
|
||||
$roleData = json_decode(file_get_contents($roleDataUrl), true);
|
||||
$roleData = app(BorisStaticDataClient::class)->getChampionRates();
|
||||
$changeCount = 0;
|
||||
|
||||
foreach ($roleData['data'] as $championId => $roles) {
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Champion;
|
||||
use App\Services\BorisStaticDataClient;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class ChampionSeeder extends Seeder
|
||||
@@ -15,10 +15,7 @@ class ChampionSeeder extends Seeder
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$championData = Http::get('https://static.heimerdinger.lol/champions.json')->json();
|
||||
if (!is_array($championData)) {
|
||||
$championData = Http::get('https://cdn.merakianalytics.com/riot/lol/resources/latest/en-US/champions.json')->json();
|
||||
}
|
||||
$championData = app(BorisStaticDataClient::class)->getChampions();
|
||||
$changeCount = 0;
|
||||
|
||||
foreach ($championData as $champion) {
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\ChampionSkin;
|
||||
use App\Services\BorisStaticDataClient;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class ChampionSkinSeeder extends Seeder
|
||||
@@ -15,10 +15,7 @@ class ChampionSkinSeeder extends Seeder
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$championData = Http::get('https://static.heimerdinger.lol/champions.json')->json();
|
||||
if (!is_array($championData)) {
|
||||
$championData = Http::get('https://cdn.merakianalytics.com/riot/lol/resources/latest/en-US/champions.json')->json();
|
||||
}
|
||||
$championData = app(BorisStaticDataClient::class)->getChampions();
|
||||
$changeCount = 0;
|
||||
|
||||
foreach ($championData as $champion) {
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\SkinChroma;
|
||||
use App\Services\BorisStaticDataClient;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class SkinChromaSeeder extends Seeder
|
||||
@@ -15,10 +15,7 @@ class SkinChromaSeeder extends Seeder
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$championData = Http::get('https://static.heimerdinger.lol/champions.json')->json();
|
||||
if (!is_array($championData)) {
|
||||
$championData = Http::get('https://cdn.merakianalytics.com/riot/lol/resources/latest/en-US/champions.json')->json();
|
||||
}
|
||||
$championData = app(BorisStaticDataClient::class)->getChampions();
|
||||
$changeCount = 0;
|
||||
|
||||
foreach ($championData as $champion) {
|
||||
|
||||
Reference in New Issue
Block a user