public static function statistics() { $started = strtotime(SQL::queryCell('SELECT "time" FROM "journal" WHERE id = 1')); $invested = (int) SQL::queryCell('SELECT count(*) FROM "node"'); return ['Started' => date('d-m-Y', $started), 'Running days' => floor((time() - $started) / (3600 * 24)), 'Users' => User::find()->count(), 'Total deposited' => Invoice::find()->where(['or', ['status' => 'success'], ['status' => 'delete']])->andWhere('amount > 0')->sum('amount'), 'Total withdraw' => -Invoice::find()->where(['or', ['status' => 'success'], ['status' => 'delete']])->andWhere('amount < 0')->sum('amount'), 'Number of investments' => $invested]; }
public function actionAccount() { return $this->render('account', ['model' => SQL::queryObject('SELECT * FROM "account"')]); }