mirror of
https://github.com/rico-vz/HeimerdingerLoL.git
synced 2025-12-06 10:10:48 +01:00
feat: skin list
This commit is contained in:
@@ -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'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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');
|
||||
|
||||
20
app/View/Components/Skins/Paginatedlist.php
Normal file
20
app/View/Components/Skins/Paginatedlist.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Skins;
|
||||
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\View\Component;
|
||||
use Illuminate\Pagination\LengthAwarePaginator as Paginator;
|
||||
|
||||
class Paginatedlist extends Component
|
||||
{
|
||||
|
||||
public function __construct(public Paginator $skins)
|
||||
{
|
||||
}
|
||||
|
||||
public function render(): View
|
||||
{
|
||||
return view('components.skins.paginatedlist');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user