diff --git a/app/Http/Controllers/SkinChromaController.php b/app/Http/Controllers/SkinChromaController.php new file mode 100644 index 0000000..cdd0232 --- /dev/null +++ b/app/Http/Controllers/SkinChromaController.php @@ -0,0 +1,66 @@ +|string> + */ + public function rules(): array + { + return [ + // + ]; + } +} diff --git a/app/Http/Requests/UpdateSkinChromaRequest.php b/app/Http/Requests/UpdateSkinChromaRequest.php new file mode 100644 index 0000000..c656cc6 --- /dev/null +++ b/app/Http/Requests/UpdateSkinChromaRequest.php @@ -0,0 +1,28 @@ +|string> + */ + public function rules(): array + { + return [ + // + ]; + } +} diff --git a/app/Models/ChampionSkin.php b/app/Models/ChampionSkin.php index 4e7ff74..4940cf4 100644 --- a/app/Models/ChampionSkin.php +++ b/app/Models/ChampionSkin.php @@ -41,18 +41,23 @@ class ChampionSkin extends Model return $this->belongsTo(Champion::class); } + public function chromas() + { + return $this->hasMany(SkinChroma::class, 'full_skin_id', 'full_skin_id'); + } + 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() { - 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() { - 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; } } diff --git a/app/Models/SkinChroma.php b/app/Models/SkinChroma.php new file mode 100644 index 0000000..95b7eaa --- /dev/null +++ b/app/Models/SkinChroma.php @@ -0,0 +1,24 @@ +belongsTo(Skin::class); + } +} diff --git a/app/Policies/SkinChromaPolicy.php b/app/Policies/SkinChromaPolicy.php new file mode 100644 index 0000000..adbcc8a --- /dev/null +++ b/app/Policies/SkinChromaPolicy.php @@ -0,0 +1,66 @@ + + */ +class SkinChromaFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + // + ]; + } +} diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index a6ecc0a..73a012e 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -18,11 +18,7 @@ class UserFactory extends Factory public function definition(): array { return [ - 'name' => fake()->name(), - 'email' => fake()->unique()->safeEmail(), - 'email_verified_at' => now(), - 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password - 'remember_token' => Str::random(10), + ]; } diff --git a/database/migrations/2023_10_26_175822_create_champion_skins_table.php b/database/migrations/2023_10_26_175822_create_champion_skins_table.php index 5cf59c1..19c221e 100644 --- a/database/migrations/2023_10_26_175822_create_champion_skins_table.php +++ b/database/migrations/2023_10_26_175822_create_champion_skins_table.php @@ -15,7 +15,7 @@ return new class extends Migration $table->id(); $table->integer('champion_id'); - $table->integer('full_skin_id'); + $table->unsignedBigInteger('full_skin_id')->unique(); $table->integer('skin_id'); $table->string('skin_name'); $table->longText('lore'); diff --git a/database/migrations/2023_10_27_080159_create_skin_chromas_table.php b/database/migrations/2023_10_27_080159_create_skin_chromas_table.php new file mode 100644 index 0000000..104aa5c --- /dev/null +++ b/database/migrations/2023_10_27_080159_create_skin_chromas_table.php @@ -0,0 +1,35 @@ +id(); + + $table->unsignedBigInteger('full_skin_id'); + $table->string('skin_name'); + $table->string('chroma_name'); + $table->json('chroma_colors'); + $table->string('chroma_image'); + + $table->foreign('full_skin_id')->references('full_skin_id')->on('champion_skins'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('skin_chromas'); + } +}; diff --git a/database/seeders/SkinChromaSeeder.php b/database/seeders/SkinChromaSeeder.php new file mode 100644 index 0000000..5e9112c --- /dev/null +++ b/database/seeders/SkinChromaSeeder.php @@ -0,0 +1,17 @@ +