diff --git a/app/Http/Controllers/ChampionSkinController.php b/app/Http/Controllers/ChampionSkinController.php index 4deb79a..06fdc6f 100644 --- a/app/Http/Controllers/ChampionSkinController.php +++ b/app/Http/Controllers/ChampionSkinController.php @@ -5,6 +5,7 @@ namespace App\Http\Controllers; use App\Http\Requests\StoreChampionSkinRequest; use App\Http\Requests\UpdateChampionSkinRequest; use App\Models\ChampionSkin; +use Illuminate\Support\Facades\Cache; class ChampionSkinController extends Controller { @@ -13,7 +14,11 @@ class ChampionSkinController extends Controller */ public function index() { - // + $skins = Cache::remember('championSkinsListAllCache' . request('page', 1), 60 * 60 * 8, function () { + return ChampionSkin::orderBy('id')->paginate(16); + }); + + return view('skins.index', compact('skins')); } /** diff --git a/app/Models/ChampionSkin.php b/app/Models/ChampionSkin.php index 68b5933..39649af 100644 --- a/app/Models/ChampionSkin.php +++ b/app/Models/ChampionSkin.php @@ -49,6 +49,11 @@ class ChampionSkin extends Model ]; } + public function getRarityAttribute($value) + { + return $value === null || $value === 'NoRarity' ? 'Common' : $value; + } + public function champion(): BelongsTo { return $this->belongsTo(Champion::class, 'champion_id', 'champion_id'); diff --git a/app/View/Components/Skins/Paginatedlist.php b/app/View/Components/Skins/Paginatedlist.php new file mode 100644 index 0000000..d7734ac --- /dev/null +++ b/app/View/Components/Skins/Paginatedlist.php @@ -0,0 +1,20 @@ +splash_color}}">