🌈 Skin Chromas

This commit is contained in:
Rico van Zelst
2023-10-27 10:20:17 +02:00
parent bb771faf25
commit 021eae9bf4
11 changed files with 297 additions and 9 deletions

View File

@@ -0,0 +1,66 @@
<?php
namespace App\Http\Controllers;
use App\Models\SkinChroma;
use App\Http\Requests\StoreSkinChromaRequest;
use App\Http\Requests\UpdateSkinChromaRequest;
class SkinChromaController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(StoreSkinChromaRequest $request)
{
//
}
/**
* Display the specified resource.
*/
public function show(SkinChroma $skinChroma)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(SkinChroma $skinChroma)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(UpdateSkinChromaRequest $request, SkinChroma $skinChroma)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(SkinChroma $skinChroma)
{
//
}
}

View File

@@ -0,0 +1,28 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StoreSkinChromaRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
//
];
}
}

View File

@@ -0,0 +1,28 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UpdateSkinChromaRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
//
];
}
}

View File

@@ -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;
}
}

24
app/Models/SkinChroma.php Normal file
View File

@@ -0,0 +1,24 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class SkinChroma extends Model
{
use HasFactory;
protected $fillable = [
'full_skin_id',
'skin_name',
'chroma_name',
'chroma_colors',
'chroma_image',
];
public function skin()
{
return $this->belongsTo(Skin::class);
}
}

View File

@@ -0,0 +1,66 @@
<?php
namespace App\Policies;
use App\Models\SkinChroma;
use App\Models\User;
use Illuminate\Auth\Access\Response;
class SkinChromaPolicy
{
/**
* Determine whether the user can view any models.
*/
public function viewAny(User $user): bool
{
//
}
/**
* Determine whether the user can view the model.
*/
public function view(User $user, SkinChroma $skinChroma): bool
{
//
}
/**
* Determine whether the user can create models.
*/
public function create(User $user): bool
{
//
}
/**
* Determine whether the user can update the model.
*/
public function update(User $user, SkinChroma $skinChroma): bool
{
//
}
/**
* Determine whether the user can delete the model.
*/
public function delete(User $user, SkinChroma $skinChroma): bool
{
//
}
/**
* Determine whether the user can restore the model.
*/
public function restore(User $user, SkinChroma $skinChroma): bool
{
//
}
/**
* Determine whether the user can permanently delete the model.
*/
public function forceDelete(User $user, SkinChroma $skinChroma): bool
{
//
}
}