minor fixes
This commit is contained in:
@@ -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'));
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user