<?php

namespace App\Http\Controllers\Guru;

use App\Http\Controllers\Controller;
use App\Models\Game;
use Illuminate\View\View;

class GameController extends Controller
{
    public function index(): View
    {
        return view('guru.game', [
            'games' => Game::where('status', 'aktif')
                ->orderBy('judul')
                ->get(),
        ]);
    }

    public function main(Game $game): View
    {
        abort_unless($game->status === 'aktif', 404);

        return view('guru.game-main', [
            'game' => $game,
        ]);
    }
}
