Commit c14a8453 by Скуратович Александр

статистика

1 parent e56f9384
...@@ -68,11 +68,16 @@ class SiteController extends Controller ...@@ -68,11 +68,16 @@ class SiteController extends Controller
//var_dump(Yii::$app->user->isGuest); //var_dump(Yii::$app->user->isGuest);
//var_dump(Yii::$app->user->identity); //var_dump(Yii::$app->user->identity);
$statistics = ['csv_date' => '']; $statistics = ['csv_date' => ''];
$statistics['c_status'] = Host::find()->select(['COUNT(*) AS cnt', 'wis_status'])->groupBy('wis_status')->all(); $statistics['c_status'] = (new yii\db\Query())
->select(['COUNT(*) AS cnt', 'wis_status'])
->from('{{%host}}')
->groupBy(['csv_date'])
->all();
$csv = Host::find()->select(['csv_date'])->orderBy('csv_date ASC')->one(); $csv = Host::find()->select(['csv_date'])->orderBy('csv_date ASC')->one();
if ($csv) { if ($csv) {
$statistics['csv_date'] = $csv['csv_date']; $statistics['csv_date'] = $csv['csv_date'];
} }
return $this->render('index', compact('statistics')); return $this->render('index', compact('statistics'));
} }
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!