mirror of
https://github.com/rico-vz/HeimerdingerLoL.git
synced 2025-12-06 18:20:48 +01:00
feat: Implement new way of fetching champ info
Introduced a new environment variable, MAMC_SECRET, to securely fetch champion data from an external API. This secret is now used in the ChampionSeeder, ChampionSkinSeeder and SkinChromaSeeder classes to authenticate requests. The .env.example and app configuration files have been updated accordingly.
This commit is contained in:
@@ -6,6 +6,7 @@ use App\Models\ChampionSkin;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class ChampionSkinSeeder extends Seeder
|
||||
{
|
||||
@@ -14,8 +15,12 @@ class ChampionSkinSeeder extends Seeder
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$championDataUrl = 'https://cdn.merakianalytics.com/riot/lol/resources/latest/en-US/champions.json';
|
||||
$championData = json_decode(file_get_contents($championDataUrl), true);
|
||||
$mamcSecret = config('app.MAMC_SECRET');
|
||||
|
||||
$championDataUrl = 'https://mamchamp.orianna.dev/champion-data';
|
||||
$championData = Http::withHeaders([
|
||||
'MAM-Get-Secret' => $mamcSecret,
|
||||
])->get($championDataUrl)->json();
|
||||
$changeCount = 0;
|
||||
|
||||
foreach ($championData as $champion) {
|
||||
|
||||
Reference in New Issue
Block a user