/** * Displays homepage. * * @return mixed */ public function actionIndex() { $matches = Match::find()->with('team', 'competition')->orderBy(['date_time' => SORT_DESC])->asArray()->all(); $trainingMatches = TrainingMatch::find()->with('greenPlayers', 'purplePlayers')->orderBy(['date_time' => SORT_DESC])->asArray()->all(); $trainingMatchStandings = TrainingMatchStandings::find()->one()->sorted(); $playersStatisticSummary = PlayerStatisticSummary::find()->with(['player' => function ($query) { $query->with('playerLastResultsAggregated'); }])->orderBy(['count_points' => SORT_DESC, 'count_games' => SORT_ASC])->limit(5)->asArray()->all(); $playersRatingLebedev = PlayerRatingLebedevSummary::find()->with(['player' => function ($query) { $query->with('playerLastResultsAggregated'); }])->orderBy(['rating_lebedev_avg' => SORT_DESC])->limit(5)->asArray()->all(); return $this->render('index', ['matches' => $matches, 'trainingMatches' => $trainingMatches, 'trainingMatchStandings' => $trainingMatchStandings, 'playersStatisticSummary' => $playersStatisticSummary, 'playersRatingLebedev' => $playersRatingLebedev]); }