/** * Updates a Ranking into * the provided tournament. * * @param int $adminID * @param int $rankingID * @param int $score * @param int $tournamentID * @param int $playerID * * @return Ranking */ public function updateRanking($adminID, $rankingID, $score = 0, $tournamentID = null, $playerID = null) { $admin = $this->administratorsRepository->get($adminID); $player = null; $tournament = null; if ($playerID) { $player = $this->playersRepo->getPlayer($playerID); } if ($tournamentID) { $tournament = $this->tournamentsRepo->getTournament($tournamentID); } return $this->repo->updateRanking($admin, $rankingID, $score, $tournament, $player); }
/** * Updates an existing match into the desired * Tournament. * * @param int $matchID * @param int $firstPlayerID * @param int $secondPlayerID * @param int $winnerID * @param Carbon $begin * @param Carbon $finish * @param boolean $hasEnded * * @throws Illuminate\Database\Eloquent\ModelNotFoundException * * @return Match */ public function updateMatch($matchID, $firstPlayerID = null, $secondPlayerID = null, $winnerID = null, \Carbon\Carbon $begin = null, \Carbon\Carbon $finish = null, $hasEnded = false) { $firstPlayer = null; $secondPlayer = null; $winner = null; if ($firstPlayerID) { $firstPlayer = $this->playersRepo->getPlayer($firstPlayerID); } if ($secondPlayerID) { $secondPlayer = $this->playersRepo->getPlayer($secondPlayerID); } if ($winnerID) { $winner = $this->playersRepo->getPlayer($winnerID); } return $this->repo->updateMatch(\Admin::getLogged(), $matchID, $firstPlayer, $secondPlayer, $winner, $begin, $finish, $hasEnded); }