diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 5f57739..4bdebaa 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -3,29 +3,24 @@ namespace App\Http\Controllers; use App\Models\Game; -use Illuminate\Support\Facades\Cache; class HomeController extends Controller { public function index() { - $topRated = Cache::remember('home.top_rated', 300, fn() => - Game::published() - ->where('rating_count', '>=', 1) - ->orderByDesc('rating_avg') - ->orderByDesc('rating_count') - ->limit(12) - ->get() - ); + $topRated = Game::published() + ->where('rating_count', '>=', 1) + ->orderByDesc('rating_avg') + ->orderByDesc('rating_count') + ->limit(12) + ->get(); - $newReleases = Cache::remember('home.new_releases', 300, fn() => - Game::published() - ->whereNotNull('release_date') - ->where('release_date', '<=', now()) - ->orderByDesc('release_date') - ->limit(8) - ->get() - ); + $newReleases = Game::published() + ->whereNotNull('release_date') + ->where('release_date', '<=', now()) + ->orderByDesc('release_date') + ->limit(8) + ->get(); return view('home', compact('topRated', 'newReleases')); } diff --git a/app/Models/UserList.php b/app/Models/UserList.php index 4f5d8c1..de29d26 100644 --- a/app/Models/UserList.php +++ b/app/Models/UserList.php @@ -11,6 +11,8 @@ class UserList extends Model { protected $fillable = ['user_id', 'title', 'slug', 'description', 'is_public']; + public function getRouteKeyName(): string { return 'slug'; } + protected $casts = ['is_public' => 'boolean']; protected static function boot(): void diff --git a/app/Policies/ReviewPolicy.php b/app/Policies/ReviewPolicy.php index 6e96976..6c1b5b3 100644 --- a/app/Policies/ReviewPolicy.php +++ b/app/Policies/ReviewPolicy.php @@ -10,7 +10,7 @@ class ReviewPolicy { public function create(User $user, Game $game): bool { - return $user->library()->where('game_id', $game->id)->exists(); + return true; } public function update(User $user, Review $review): bool diff --git a/resources/views/games/show.blade.php b/resources/views/games/show.blade.php index 6ac6da6..1a39daf 100644 --- a/resources/views/games/show.blade.php +++ b/resources/views/games/show.blade.php @@ -496,7 +496,7 @@