i am trying to display tree structure in blade, and i need i little help.
So Here is my algorithm
public function fetchData($entry_id)
{
$results = TreeEntry::where('parent_entry_id', $entry_id)->get();
$treeEntryList = [];
foreach ($results as $result) {
$data = [
'id' => $result->entry_id,
'parent_entry_id' => $result->parent_entry_id,
'children' => $this->fetchData($result->entry_id)
];
$treeEntryList[] = $data;
}
And getting this kind of tree array

And trying something like this, but only first child node getting displayed, and i want to show all elements. Any idea how to solve this? Recursion here, or maybe something else?
@extends('layouts.master')
@section('content')
{{dd($resultList)}}
<div class="container">
<br id="lang-container">
@foreach ($resultList as $result)
<div>{{$result['id']}}</div></br>
@foreach ($result['children'] as $child)
<div>{{$child['id']}}</div></br>
@endforeach
@endforeach
</div>
@endsection
@section('js')
@endsection