diff --git a/app/Http/Controllers/ChampionController.php b/app/Http/Controllers/ChampionController.php new file mode 100644 index 0000000..26cd9e2 --- /dev/null +++ b/app/Http/Controllers/ChampionController.php @@ -0,0 +1,66 @@ +|string> + */ + public function rules(): array + { + return [ + // + ]; + } +} diff --git a/app/Http/Requests/StoreChampionSkinRequest.php b/app/Http/Requests/StoreChampionSkinRequest.php new file mode 100644 index 0000000..3665587 --- /dev/null +++ b/app/Http/Requests/StoreChampionSkinRequest.php @@ -0,0 +1,28 @@ +|string> + */ + public function rules(): array + { + return [ + // + ]; + } +} diff --git a/app/Http/Requests/UpdateChampionRequest.php b/app/Http/Requests/UpdateChampionRequest.php new file mode 100644 index 0000000..a58f6be --- /dev/null +++ b/app/Http/Requests/UpdateChampionRequest.php @@ -0,0 +1,28 @@ +|string> + */ + public function rules(): array + { + return [ + // + ]; + } +} diff --git a/app/Http/Requests/UpdateChampionSkinRequest.php b/app/Http/Requests/UpdateChampionSkinRequest.php new file mode 100644 index 0000000..0190a2d --- /dev/null +++ b/app/Http/Requests/UpdateChampionSkinRequest.php @@ -0,0 +1,28 @@ +|string> + */ + public function rules(): array + { + return [ + // + ]; + } +} diff --git a/app/Models/Champion.php b/app/Models/Champion.php new file mode 100644 index 0000000..701f9ee --- /dev/null +++ b/app/Models/Champion.php @@ -0,0 +1,81 @@ + 'array', + ]; + + public function skins() + { + return $this->hasMany(ChampionSkin::class); + } + + public function getChampionImageAttribute() + { + return 'https://cdn.communitydragon.org/latest/champion/' . $this->champion_id . '/splash-art'; + } + + public function getChampionImageLoadingAttribute() + { + return 'https://cdn.communitydragon.org/latest/champion/' . $this->champion_id . '/portrait'; + } + + public function getChampionImageTileAttribute() + { + return 'https://cdn.communitydragon.org/latest/champion/' . $this->champion_id . '/tile'; + } + + public function getChampionSquareImageAttribute() + { + return 'https://cdn.communitydragon.org/latest/champion/' . $this->champion_id . '/square'; + } + + public function getChampionAbilityIconQAttribute() + { + return 'https://cdn.communitydragon.org/latest/champion/' . $this->champion_id . '/ability-icon/q'; + } + + public function getChampionAbilityIconWAttribute() + { + return 'https://cdn.communitydragon.org/latest/champion/' . $this->champion_id . '/ability-icon/w'; + } + + public function getChampionAbilityIconEAttribute() + { + return 'https://cdn.communitydragon.org/latest/champion/' . $this->champion_id . '/ability-icon/e'; + } + + public function getChampionAbilityIconRAttribute() + { + return 'https://cdn.communitydragon.org/latest/champion/' . $this->champion_id . '/ability-icon/r'; + } + + public function getChampionAbilityIconPAttribute() + { + return 'https://cdn.communitydragon.org/latest/champion/' . $this->champion_id . '/ability-icon/p'; + } +} diff --git a/app/Models/ChampionSkin.php b/app/Models/ChampionSkin.php new file mode 100644 index 0000000..23b5955 --- /dev/null +++ b/app/Models/ChampionSkin.php @@ -0,0 +1,58 @@ + 'array', + 'voice_actor' => 'array', + 'splash_artist' => 'array', + ]; + + public function champion() + { + return $this->belongsTo(Champion::class); + } + + public function getSkinImageAttribute() + { + 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; + } + + public function getSkinImageTileAttribute() + { + return 'https://cdn.communitydragon.org/latest/champion/' . $this->champion_id . '/tile/skin/' . $this->skin_id; + } +} diff --git a/app/Policies/ChampionPolicy.php b/app/Policies/ChampionPolicy.php new file mode 100644 index 0000000..f038a40 --- /dev/null +++ b/app/Policies/ChampionPolicy.php @@ -0,0 +1,66 @@ + + */ +class ChampionFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + // + ]; + } +} diff --git a/database/factories/ChampionSkinFactory.php b/database/factories/ChampionSkinFactory.php new file mode 100644 index 0000000..ccc9740 --- /dev/null +++ b/database/factories/ChampionSkinFactory.php @@ -0,0 +1,23 @@ + + */ +class ChampionSkinFactory extends Factory +{ + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + // + ]; + } +} diff --git a/database/migrations/2023_10_25_180120_create_champions_table.php b/database/migrations/2023_10_25_180120_create_champions_table.php new file mode 100644 index 0000000..c723a9b --- /dev/null +++ b/database/migrations/2023_10_25_180120_create_champions_table.php @@ -0,0 +1,42 @@ +id(); + + $table->integer('champion_id')->unique(); + $table->string('key')->unique(); + $table->string('name'); + $table->string('title'); + $table->longText('lore'); + $table->json('roles'); + $table->integer('price_be'); + $table->integer('price_rp'); + $table->string('resource_type'); + $table->string('attack_type'); + $table->string('adaptive_type'); + $table->string('release_date'); + $table->string('release_patch'); + + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('champions'); + } +}; 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 new file mode 100644 index 0000000..5cf59c1 --- /dev/null +++ b/database/migrations/2023_10_26_175822_create_champion_skins_table.php @@ -0,0 +1,49 @@ +id(); + + $table->integer('champion_id'); + $table->integer('full_skin_id'); + $table->integer('skin_id'); + $table->string('skin_name'); + $table->longText('lore'); + $table->string('availability'); + $table->boolean('loot_eligible'); + $table->bigInteger('rp_price'); + $table->string('raritiy'); + $table->string('release_date'); + $table->json('associated_skinline'); + $table->boolean('new_effects'); + $table->boolean('new_animations'); + $table->boolean('new_recall'); + $table->boolean('new_voice'); + $table->boolean('new_quotes'); + $table->json('voice_actor'); + $table->json('splash_artist'); + + $table->foreign('champion_id')->references('champion_id')->on('champions')->onDelete('cascade'); + + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('champion_skins'); + } +}; diff --git a/database/seeders/ChampionSeeder.php b/database/seeders/ChampionSeeder.php new file mode 100644 index 0000000..d391999 --- /dev/null +++ b/database/seeders/ChampionSeeder.php @@ -0,0 +1,17 @@ +create(); - - // \App\Models\User::factory()->create([ - // 'name' => 'Test User', - // 'email' => 'test@example.com', - // ]); } }