<?php
require_once '../../../4p1c_4cc45t0db._.php';
require_once '../utils/helpers.php';
require_once '../models/Player.php';
require_once '../models/Tournament.php';

class PlayerController
{
    private $playerModel;
    private $tournamentModel;

    public function __construct()
    {
        $db = Database::connect();
        $this->playerModel = new Player($db);
        $this->tournamentModel = new Tournament($db);
    }

    public function show($id)
    {
        $player = null;
        if ($id) {
            $player = $this->playerModel->getPlayerById($id);
            $tournaments = $this->tournamentModel->getTournamentByPlayer($id);
        }

        require '../views/player.php';
    }
}
