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
|
||||
|
||||
@@ -496,7 +496,7 @@
|
||||
<div x-show="!reviewId || editing">
|
||||
<textarea x-model="body" rows="5" placeholder="Share your thoughts (minimum 50 characters)…"
|
||||
class="w-full bg-[#0f0f13] border border-white/10 rounded-lg px-4 py-3 text-sm text-slate-200 placeholder-slate-500 focus:outline-none focus:border-purple-500 focus:ring-1 focus:ring-purple-500 resize-none transition"></textarea>
|
||||
<p class="text-xs text-slate-500 mt-1 mb-3" x-text="body.length + ' / 50 min'"></p>
|
||||
<p class="text-xs text-slate-500 mt-1 mb-3" x-text="body.length + ' | minimum 50 characters'"></p>
|
||||
|
||||
<div class="flex flex-wrap items-center gap-4 mb-4">
|
||||
<div class="flex items-center gap-2">
|
||||
|
||||
+4
-4
@@ -51,10 +51,10 @@ Route::middleware('auth')->group(function () {
|
||||
// Lists
|
||||
Route::get('/lists', [\App\Http\Controllers\ListController::class, 'index'])->name('lists.index')->middleware('auth');
|
||||
Route::post('/lists', [\App\Http\Controllers\ListController::class, 'store'])->name('lists.store')->middleware('auth');
|
||||
Route::get('/lists/{list}', [\App\Http\Controllers\ListController::class, 'show'])->name('lists.show');
|
||||
Route::delete('/lists/{list}', [\App\Http\Controllers\ListController::class, 'destroy'])->name('lists.destroy')->middleware('auth');
|
||||
Route::post('/lists/{list}/games', [\App\Http\Controllers\ListController::class, 'addGame'])->name('lists.add-game')->middleware('auth');
|
||||
Route::delete('/lists/{list}/games/{game}', [\App\Http\Controllers\ListController::class, 'removeGame'])->name('lists.remove-game')->middleware('auth');
|
||||
Route::get('/lists/{list:slug}', [\App\Http\Controllers\ListController::class, 'show'])->name('lists.show');
|
||||
Route::delete('/lists/{list:slug}', [\App\Http\Controllers\ListController::class, 'destroy'])->name('lists.destroy')->middleware('auth');
|
||||
Route::post('/lists/{list:slug}/games', [\App\Http\Controllers\ListController::class, 'addGame'])->name('lists.add-game')->middleware('auth');
|
||||
Route::delete('/lists/{list:slug}/games/{game}', [\App\Http\Controllers\ListController::class, 'removeGame'])->name('lists.remove-game')->middleware('auth');
|
||||
|
||||
// Follow system
|
||||
Route::middleware('auth')->group(function () {
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
*
|
||||
!data/
|
||||
!.gitignore
|
||||
@@ -1,2 +0,0 @@
|
||||
*
|
||||
!.gitignore
|
||||
Reference in New Issue
Block a user