@php $acc = $accounts[$id]; $kids = $children[$id] ?? []; $type = $rootTypes[$id] ?? (int) $acc->account_type; $bal = $balances[$id] ?? 0; $shown = in_array($type, [1, 4], true) ? $bal : -$bal; // الرصيد حسب طبيعة الحساب @endphp