@php
// Helper to count all nested customers recursively
if (!function_exists('countNestedCustomers')) {
function countNestedCustomers($customer) {
$count = 0;
if (!empty($customer['invited'])) {
foreach ($customer['invited'] as $child) {
$count += 1 + countNestedCustomers($child);
}
}
return $count;
}
}
// Render the invitation tree recursively
if (!function_exists('renderInvitationTree')) {
function renderInvitationTree($tree) {
static $nodeId = 0;
echo '
';
}
}
@endphp
{{-- Display the invitation tree with $customer as the main user --}}
@if(isset($inviter))
@php
// Wrap $inviter as the root node, with $invitationTree as its children
$mainCustomer = $inviter;
$mainCustomer['invited'] = $invitationTree;
renderInvitationTree([$mainCustomer]);
@endphp
@else
@php
renderInvitationTree($invitationTree);
@endphp
@endif
No invitations found.