public function game($username, $idGame) { $paramsMenu = Page::getMenuParams(); $arrayRawUserInfos = BGGData::getUserInfos(); $arrayUserInfos = UserInfos::getUserInformations($arrayRawUserInfos); $params['userinfo'] = $arrayUserInfos; $arrayGameDetail = BGGData::getDetailOfGame($idGame); $arrayGameDetail = Stats::convertBggDetailInfo($arrayGameDetail); $arrayGameDetail = array_merge($arrayGameDetail, Stats::getDetailInfoGame($arrayGameDetail)); $arrayRawGamesPlays = BGGData::getPlays(); $arrayRawGamesOwned = BGGData::getGamesOwned(); $arrayGamesDetails = BGGData::getDetailOwned($arrayRawGamesOwned); $arrayRawGamesAndExpansionsOwned = BGGData::getGamesAndExpansionsOwned(); Stats::getCollectionArrays($arrayRawGamesOwned); Stats::getOwnedRelatedArrays($arrayGamesDetails); Stats::getOwnedExpansionLink($arrayRawGamesAndExpansionsOwned); if (isset($GLOBALS['data']['gamesCollection'][$idGame])) { $arrayGameDetail['collection'] = $GLOBALS['data']['gamesCollection'][$idGame]; } Stats::getPlaysRelatedArrays($arrayRawGamesPlays); if (isset($GLOBALS['data']['arrayTotalPlays'][$idGame])) { $arrayGameDetail['numplays'] = count($GLOBALS['data']['arrayTotalPlays'][$idGame]); $allPlays = $GLOBALS['data']['arrayTotalPlays'][$idGame]['plays']; if ($allPlays) { uasort($allPlays, 'App\\Lib\\Utility::compareDate'); $arrayGameDetail['lastPlayed']['date'] = $allPlays[0]['date']; $arrayGameDetail['lastPlayed']['since'] = Carbon::createFromTimestamp($allPlays[0]['date'])->diffForHumans(); $arrayGameDetail['plays'] = $allPlays; } else { $arrayGameDetail['lastPlayed'] = ''; } } else { $arrayGameDetail['numplays'] = 0; $arrayGameDetail['lastPlayed'] = ''; $arrayGameDetail['plays'] = []; } $params['game'] = $arrayGameDetail; $params = array_merge($params, $paramsMenu); return \View::make('game', $params); }