/**
  * Возвращаем дату последнего обновления информации по NS серверам провайдера
  *
  * @return mixed
  */
 public static function getLastAvailableDate()
 {
     $db = \Yii::$app->db;
     $query = $db->createCommand("SELECT max(date) AS last_date FROM " . DomainCountStatistic::tableName());
     $last_date = $query->queryOne();
     return $last_date['last_date'];
 }
 /**
  * @return AbstractStatisticQuery
  * @throws Exception
  */
 public function getQuery()
 {
     switch ($this->statisic_type) {
         case StatisticController::STATISTIC_AS:
             return AsCountStatistic::find()->with(AsCountStatistic::R_AS_LIST);
         case StatisticController::STATISTIC_A:
             return ACountStatistic::find()->with(ACountStatistic::R_AS_LIST);
         case StatisticController::STATISTIC_CNAME:
             return CnameCountStatistic::find();
         case StatisticController::STATISTIC_DOMAIN:
             return DomainCountStatistic::find();
         case StatisticController::STATISTIC_MX:
             return MxCountStatistic::find();
         case StatisticController::STATISTIC_NS:
             return NsCountStatistic::find();
         case StatisticController::STATISTIC_REGISTRANT:
             return RegistrantCountStatistic::find();
         case StatisticController::STATISTIC_REGRU:
             return RegruStatData::find()->with(RegruStatData::R_REGRU_PROVIDERS);
     }
     throw new Exception('Not found correct type');
 }