public function actionDetails($id)
 {
     // Нужен для возврата на страницу после логина
     // Возможно делается как-то проще
     Url::remember();
     $trainingMatch = TrainingMatch::find()->with('greenPlayers', 'purplePlayers', 'refusedPlayers')->with(['greenPlayers.playerStars' => function ($query) use($id) {
         $query->where(['training_match_id' => $id]);
     }, 'purplePlayers.playerStars' => function ($query) use($id) {
         $query->where(['training_match_id' => $id]);
     }])->where(['id' => $id])->orderBy('')->asArray()->one();
     // Merge all players
     // accepted or refused current match
     $players = array_merge($trainingMatch['greenPlayers'], $trainingMatch['purplePlayers'], $trainingMatch['refusedPlayers']);
     $playerIds = array_map(function ($player) {
         return $player['id'];
     }, $players);
     // Other players
     $otherPlayers = Player::find()->with('playerStatisticSummary')->where(['not in', 'id', $playerIds])->all();
     // Sort players by games count
     usort($otherPlayers, function ($a, $b) {
         return $b['playerStatisticSummary']['count_games'] - $a['playerStatisticSummary']['count_games'];
     });
     $matchTimestamp = strtotime($trainingMatch['date_time']);
     return $this->render('details', ['trainingMatch' => $trainingMatch, 'otherPlayers' => $otherPlayers, 'weather' => WeatherService::getWeather($matchTimestamp)]);
 }
 private function sendAnnouncementMessage($id)
 {
     $trainingMatch = TrainingMatch::find()->where(['id' => $id])->one();
     // Погода
     $matchTimestamp = strtotime($trainingMatch->date_time);
     $weather = WeatherService::getWeather($matchTimestamp);
     $weatherText = 'хз';
     if ($weather != null) {
         $weatherText = $weather['name'] . ', ' . $weather['temperature'] . '°C';
     }
     // Ссылка на детали
     // @fixme
     $url = 'https://mercdev-soccer.herokuapp.com/index.php/training-match/details?id=' . $trainingMatch->id;
     // Дата
     $dateText = Yii::$app->formatter->asDatetime($trainingMatch->date_time, 'dd MMM Y');
     $text = ':soccer:Играем ' . $dateText . '.' . PHP_EOL . ':partly_sunny:Погодка — ' . $weatherText . PHP_EOL . ':mercdev:Плюсуем по ссылочке' . PHP_EOL . $url;
     SlackService::sendMessage($text);
 }