getUser(); $user = (new UserRepository())->getByLogin($auth_user['login']); $account_repo = new AccountRepository(); $accounts = $user ? $account_repo->getList('*', ['user_id' => $user->id, 'is_delete' => 0], '`order`') : []; $archived_accounts = $user ? $account_repo->getList('*', ['user_id' => $user->id, 'is_delete' => 1], 'title') : []; $total = array_sum(array_map( static fn ($account) => $account->include_in_total && $account->currency === 'RUB' ? (float)$account->summa : 0, $accounts ?: [] )); return $this->render('index', [ 'user' => $auth_user, 'accounts' => $accounts ?: [], 'archived_accounts' => $archived_accounts ?: [], 'total' => $total, ]); } }