getUser(); $user = (new UserRepository())->getByLogin($auth_user['login']); $accounts = $user ? (new AccountRepository())->getList('*', ['user_id' => $user->id, 'is_delete' => 0], '`order`') : []; $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 ?: [], 'total' => $total, ]); } }