@if($categories->count()>0)
@foreach ($categories as $category)
@if($category->children->count() > 0)
@foreach($category->children as $child)
@php
$childMatches = strlen($this->searchTerm) >= 3
&& \Illuminate\Support\Str::contains(strtolower($child->name), strtolower($this->searchTerm));
@endphp
@if (strlen($this->searchTerm) < 3 || $childMatches)
{{ $child->name }}
{{ $child->companies_count }}
@endif
@endforeach
@endif
@endforeach
@else
@if(strlen($this->searchTerm) >= 3)
No categories found matching your search term "{{ $this->searchTerm }}".
Try different keywords or remove the search filter to see more categories.
@else
No categories available at the moment.
@endif
@endif