@foreach($subcategories['journalEntryList'] as $journalEntry) {{$journalEntry->getChartOfAccount->code}} - {{$journalEntry->getChartOfAccount->name}} {{$journalEntry->debit ?? $journalEntry->credit}} @php Log::channel('local_log')->info("INSIDE LOOP: {$journalEntry->getChartOfAccount->code} - Parent {$journalEntry->getChartOfAccount->parent_id}"); @endphp @endforeach @if(count($subcategories['subcategory']) > 0) @foreach($subcategories['subcategory'] as $subcategory) @if(count($subcategory['journalEntryList']) > 0 ) @php Log::channel('local_log')->info("inside if: {$subcategory->parent_id} - DEBIT {$subcategory->parent_id}"); @endphp {{$subcategory->parent->code}} - {{$subcategory->parent->name}} @include('accounting.reports.sub_expense_view', ['subcategories'=>$subcategory, 'level' => ($level + 2)]) @else @include('accounting.reports.sub_expense_view', ['subcategories'=>$subcategory, 'level' => ($level + 2)]) @endif @endforeach @endif