mirror of
https://github.com/rico-vz/HeimerdingerLoL.git
synced 2025-12-06 10:10:48 +01:00
style: laravel pint lint
This commit is contained in:
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Models\SkinChroma;
|
|
||||||
use App\Http\Requests\StoreSkinChromaRequest;
|
use App\Http\Requests\StoreSkinChromaRequest;
|
||||||
use App\Http\Requests\UpdateSkinChromaRequest;
|
use App\Http\Requests\UpdateSkinChromaRequest;
|
||||||
|
use App\Models\SkinChroma;
|
||||||
|
|
||||||
class SkinChromaController extends Controller
|
class SkinChromaController extends Controller
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ class Champion extends Model
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'slug' => [
|
'slug' => [
|
||||||
'source' => 'name'
|
'source' => 'name',
|
||||||
]
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,46 +47,46 @@ class Champion extends Model
|
|||||||
|
|
||||||
public function getChampionImageAttribute()
|
public function getChampionImageAttribute()
|
||||||
{
|
{
|
||||||
return 'https://cdn.communitydragon.org/latest/champion/' . $this->champion_id . '/splash-art';
|
return 'https://cdn.communitydragon.org/latest/champion/'.$this->champion_id.'/splash-art';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getChampionImageLoadingAttribute()
|
public function getChampionImageLoadingAttribute()
|
||||||
{
|
{
|
||||||
return 'https://cdn.communitydragon.org/latest/champion/' . $this->champion_id . '/portrait';
|
return 'https://cdn.communitydragon.org/latest/champion/'.$this->champion_id.'/portrait';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getChampionImageTileAttribute()
|
public function getChampionImageTileAttribute()
|
||||||
{
|
{
|
||||||
return 'https://cdn.communitydragon.org/latest/champion/' . $this->champion_id . '/tile';
|
return 'https://cdn.communitydragon.org/latest/champion/'.$this->champion_id.'/tile';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getChampionSquareImageAttribute()
|
public function getChampionSquareImageAttribute()
|
||||||
{
|
{
|
||||||
return 'https://cdn.communitydragon.org/latest/champion/' . $this->champion_id . '/square';
|
return 'https://cdn.communitydragon.org/latest/champion/'.$this->champion_id.'/square';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getChampionAbilityIconQAttribute()
|
public function getChampionAbilityIconQAttribute()
|
||||||
{
|
{
|
||||||
return 'https://cdn.communitydragon.org/latest/champion/' . $this->champion_id . '/ability-icon/q';
|
return 'https://cdn.communitydragon.org/latest/champion/'.$this->champion_id.'/ability-icon/q';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getChampionAbilityIconWAttribute()
|
public function getChampionAbilityIconWAttribute()
|
||||||
{
|
{
|
||||||
return 'https://cdn.communitydragon.org/latest/champion/' . $this->champion_id . '/ability-icon/w';
|
return 'https://cdn.communitydragon.org/latest/champion/'.$this->champion_id.'/ability-icon/w';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getChampionAbilityIconEAttribute()
|
public function getChampionAbilityIconEAttribute()
|
||||||
{
|
{
|
||||||
return 'https://cdn.communitydragon.org/latest/champion/' . $this->champion_id . '/ability-icon/e';
|
return 'https://cdn.communitydragon.org/latest/champion/'.$this->champion_id.'/ability-icon/e';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getChampionAbilityIconRAttribute()
|
public function getChampionAbilityIconRAttribute()
|
||||||
{
|
{
|
||||||
return 'https://cdn.communitydragon.org/latest/champion/' . $this->champion_id . '/ability-icon/r';
|
return 'https://cdn.communitydragon.org/latest/champion/'.$this->champion_id.'/ability-icon/r';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getChampionAbilityIconPAttribute()
|
public function getChampionAbilityIconPAttribute()
|
||||||
{
|
{
|
||||||
return 'https://cdn.communitydragon.org/latest/champion/' . $this->champion_id . '/ability-icon/p';
|
return 'https://cdn.communitydragon.org/latest/champion/'.$this->champion_id.'/ability-icon/p';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,8 +42,8 @@ class ChampionSkin extends Model
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'slug' => [
|
'slug' => [
|
||||||
'source' => 'skin_name'
|
'source' => 'skin_name',
|
||||||
]
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,16 +59,16 @@ class ChampionSkin extends Model
|
|||||||
|
|
||||||
public function getSkinImageAttribute()
|
public function getSkinImageAttribute()
|
||||||
{
|
{
|
||||||
return 'https://cdn.communitydragon.org/latest/champion/' . $this->champion_id . '/splash-art/centered/skin/' . $this->skin_id;
|
return 'https://cdn.communitydragon.org/latest/champion/'.$this->champion_id.'/splash-art/centered/skin/'.$this->skin_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSkinImageLoadingAttribute()
|
public function getSkinImageLoadingAttribute()
|
||||||
{
|
{
|
||||||
return 'https://cdn.communitydragon.org/latest/champion/' . $this->champion_id . '/portrait/skin/' . $this->skin_id;
|
return 'https://cdn.communitydragon.org/latest/champion/'.$this->champion_id.'/portrait/skin/'.$this->skin_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSkinImageTileAttribute()
|
public function getSkinImageTileAttribute()
|
||||||
{
|
{
|
||||||
return 'https://cdn.communitydragon.org/latest/champion/' . $this->champion_id . '/tile/skin/' . $this->skin_id;
|
return 'https://cdn.communitydragon.org/latest/champion/'.$this->champion_id.'/tile/skin/'.$this->skin_id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,11 +25,12 @@ class SkinChroma extends Model
|
|||||||
|
|
||||||
public function sluggable(): array
|
public function sluggable(): array
|
||||||
{
|
{
|
||||||
$slug = $this->chroma_name . ' ' . $this->skin_name;
|
$slug = $this->chroma_name.' '.$this->skin_name;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'slug' => [
|
'slug' => [
|
||||||
'source' => $slug
|
'source' => $slug,
|
||||||
]
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ namespace App\Policies;
|
|||||||
|
|
||||||
use App\Models\SkinChroma;
|
use App\Models\SkinChroma;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Auth\Access\Response;
|
|
||||||
|
|
||||||
class SkinChromaPolicy
|
class SkinChromaPolicy
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
namespace Database\Factories;
|
namespace Database\Factories;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
use Illuminate\Support\Str;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
use Illuminate\Database\Seeder;
|
|
||||||
use App\Models\Champion;
|
use App\Models\Champion;
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
class ChampionSeeder extends Seeder
|
class ChampionSeeder extends Seeder
|
||||||
@@ -13,7 +13,7 @@ class ChampionSeeder extends Seeder
|
|||||||
*/
|
*/
|
||||||
public function run(): void
|
public function run(): void
|
||||||
{
|
{
|
||||||
$championDataUrl = "http://cdn.merakianalytics.com/riot/lol/resources/latest/en-US/champions.json";
|
$championDataUrl = 'http://cdn.merakianalytics.com/riot/lol/resources/latest/en-US/champions.json';
|
||||||
$championData = json_decode(file_get_contents($championDataUrl), true);
|
$championData = json_decode(file_get_contents($championDataUrl), true);
|
||||||
|
|
||||||
foreach ($championData as $champion) {
|
foreach ($championData as $champion) {
|
||||||
@@ -39,10 +39,10 @@ class ChampionSeeder extends Seeder
|
|||||||
// Check if the champion already exists and if any attributes have changed, if so update the champion. If the champion doesn't exist, create it.
|
// Check if the champion already exists and if any attributes have changed, if so update the champion. If the champion doesn't exist, create it.
|
||||||
// This is to prevent the champion data from being updated every time the seeder is run. As I'll probably run this on a cron job.
|
// This is to prevent the champion data from being updated every time the seeder is run. As I'll probably run this on a cron job.
|
||||||
if ($championExists && $this->hasAttributesChanged($championExists, $championAttributes)) {
|
if ($championExists && $this->hasAttributesChanged($championExists, $championAttributes)) {
|
||||||
Log::info('Champion ' . $champion['name'] . ' has changed, updating...');
|
Log::info('Champion '.$champion['name'].' has changed, updating...');
|
||||||
$championExists->update($championAttributes);
|
$championExists->update($championAttributes);
|
||||||
} elseif (!$championExists) {
|
} elseif (! $championExists) {
|
||||||
Log::info('New champion detected! Creating ' . $champion['name'] . '...');
|
Log::info('New champion detected! Creating '.$champion['name'].'...');
|
||||||
Champion::create($championAttributes);
|
Champion::create($championAttributes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -55,6 +55,7 @@ class ChampionSeeder extends Seeder
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
use App\Models\Champion;
|
|
||||||
use App\Models\ChampionSkin;
|
use App\Models\ChampionSkin;
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
@@ -14,7 +13,7 @@ class ChampionSkinSeeder extends Seeder
|
|||||||
*/
|
*/
|
||||||
public function run(): void
|
public function run(): void
|
||||||
{
|
{
|
||||||
$championDataUrl = "http://cdn.merakianalytics.com/riot/lol/resources/latest/en-US/champions.json";
|
$championDataUrl = 'http://cdn.merakianalytics.com/riot/lol/resources/latest/en-US/champions.json';
|
||||||
$championData = json_decode(file_get_contents($championDataUrl), true);
|
$championData = json_decode(file_get_contents($championDataUrl), true);
|
||||||
|
|
||||||
foreach ($championData as $champion) {
|
foreach ($championData as $champion) {
|
||||||
@@ -23,11 +22,11 @@ class ChampionSkinSeeder extends Seeder
|
|||||||
$skinExists = ChampionSkin::where('full_skin_id', $skinId)->first();
|
$skinExists = ChampionSkin::where('full_skin_id', $skinId)->first();
|
||||||
|
|
||||||
// Original is just the base skin (so, none) so we don't need to store it.
|
// Original is just the base skin (so, none) so we don't need to store it.
|
||||||
if ($skin['name'] === "Original") {
|
if ($skin['name'] === 'Original') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($skin['cost'] == "Special") {
|
if ($skin['cost'] == 'Special') {
|
||||||
$skin['cost'] = 99999;
|
$skin['cost'] = 99999;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,7 +34,7 @@ class ChampionSkinSeeder extends Seeder
|
|||||||
'champion_id' => $champion['id'],
|
'champion_id' => $champion['id'],
|
||||||
'full_skin_id' => $skin['id'],
|
'full_skin_id' => $skin['id'],
|
||||||
'skin_id' => substr($skin['id'], 3),
|
'skin_id' => substr($skin['id'], 3),
|
||||||
'skin_name' => $skin['name'] . ' ' . $champion['name'],
|
'skin_name' => $skin['name'].' '.$champion['name'],
|
||||||
'lore' => $skin['lore'],
|
'lore' => $skin['lore'],
|
||||||
'availability' => $skin['availability'],
|
'availability' => $skin['availability'],
|
||||||
'loot_eligible' => $skin['lootEligible'],
|
'loot_eligible' => $skin['lootEligible'],
|
||||||
@@ -60,10 +59,10 @@ class ChampionSkinSeeder extends Seeder
|
|||||||
// 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.
|
// 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.
|
// 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)) {
|
if ($skinExists && $this->hasAttributesChanged($skinExists, $skinAttributes)) {
|
||||||
Log::info('Skin ' . $skin['name'] . ' ' . $champion['name'] . ' has changed, updating...');
|
Log::info('Skin '.$skin['name'].' '.$champion['name'].' has changed, updating...');
|
||||||
$skinExists->update($skinAttributes);
|
$skinExists->update($skinAttributes);
|
||||||
} elseif (!$skinExists) {
|
} elseif (! $skinExists) {
|
||||||
Log::info('New skin detected! Creating ' . $skin['name'] . ' ' . $champion['name'] . '...');
|
Log::info('New skin detected! Creating '.$skin['name'].' '.$champion['name'].'...');
|
||||||
ChampionSkin::create($skinAttributes);
|
ChampionSkin::create($skinAttributes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -77,6 +76,7 @@ class ChampionSkinSeeder extends Seeder
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,6 @@ class DatabaseSeeder extends Seeder
|
|||||||
$this->call(ChampionSkinSeeder::class);
|
$this->call(ChampionSkinSeeder::class);
|
||||||
$this->call(SkinChromaSeeder::class);
|
$this->call(SkinChromaSeeder::class);
|
||||||
|
|
||||||
Log::info('Seeding complete at ' . date('Y-m-d H:i:s'));
|
Log::info('Seeding complete at '.date('Y-m-d H:i:s'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,8 @@
|
|||||||
|
|
||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
|
||||||
use Illuminate\Database\Seeder;
|
|
||||||
use App\Models\SkinChroma;
|
use App\Models\SkinChroma;
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
class SkinChromaSeeder extends Seeder
|
class SkinChromaSeeder extends Seeder
|
||||||
@@ -14,16 +13,18 @@ class SkinChromaSeeder extends Seeder
|
|||||||
*/
|
*/
|
||||||
public function run(): void
|
public function run(): void
|
||||||
{
|
{
|
||||||
$championDataUrl = "http://cdn.merakianalytics.com/riot/lol/resources/latest/en-US/champions.json";
|
$championDataUrl = 'http://cdn.merakianalytics.com/riot/lol/resources/latest/en-US/champions.json';
|
||||||
$championData = json_decode(file_get_contents($championDataUrl), true);
|
$championData = json_decode(file_get_contents($championDataUrl), true);
|
||||||
|
|
||||||
foreach ($championData as $champion) {
|
foreach ($championData as $champion) {
|
||||||
foreach ($champion['skins'] as $skin) {
|
foreach ($champion['skins'] as $skin) {
|
||||||
if ($skin['name'] === "Original") {
|
if ($skin['name'] === 'Original') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
foreach ($skin['chromas'] as $chroma) {
|
foreach ($skin['chromas'] as $chroma) {
|
||||||
if ($chroma === null) continue; // To address: https://github.com/meraki-analytics/lolstaticdata/issues/71
|
if ($chroma === null) {
|
||||||
|
continue;
|
||||||
|
} // To address: https://github.com/meraki-analytics/lolstaticdata/issues/71
|
||||||
|
|
||||||
$chromaId = $chroma['id'];
|
$chromaId = $chroma['id'];
|
||||||
|
|
||||||
@@ -31,7 +32,7 @@ class SkinChromaSeeder extends Seeder
|
|||||||
$chromaAttributes = [
|
$chromaAttributes = [
|
||||||
'chroma_id' => $chromaId,
|
'chroma_id' => $chromaId,
|
||||||
'full_skin_id' => $skin['id'],
|
'full_skin_id' => $skin['id'],
|
||||||
'skin_name' => $skin['name'] . ' ' . $champion['name'],
|
'skin_name' => $skin['name'].' '.$champion['name'],
|
||||||
'chroma_name' => $chroma['name'],
|
'chroma_name' => $chroma['name'],
|
||||||
'chroma_colors' => $chroma['colors'],
|
'chroma_colors' => $chroma['colors'],
|
||||||
'chroma_image' => $chroma['chromaPath'],
|
'chroma_image' => $chroma['chromaPath'],
|
||||||
@@ -43,10 +44,10 @@ class SkinChromaSeeder extends Seeder
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($chromaExists && $this->hasAttributesChanged($chromaExists, $chromaAttributes)) {
|
if ($chromaExists && $this->hasAttributesChanged($chromaExists, $chromaAttributes)) {
|
||||||
Log::info('Updating chroma: ' . $chromaId);
|
Log::info('Updating chroma: '.$chromaId);
|
||||||
$chromaExists->update($chromaAttributes);
|
$chromaExists->update($chromaAttributes);
|
||||||
} else if (!$chromaExists) {
|
} elseif (! $chromaExists) {
|
||||||
Log::info('Creating chroma: ' . $chromaId);
|
Log::info('Creating chroma: '.$chromaId);
|
||||||
SkinChroma::create($chromaAttributes);
|
SkinChroma::create($chromaAttributes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -61,6 +62,7 @@ class SkinChromaSeeder extends Seeder
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user