Merhabalar,
Laravelde tüm root ve alt kategorileri getirebiliyorum ancak tek sıkıntım html <option> ile kullanırken sorun yaşıyorum. Kategorilerden hangisi root hangisi subcategory belirtemiyorum. Kategorilerin hepsini çekiyor.
category_add.blade.php
<select class="form-control select2" style="width: 100%;" name="category">
    <option value="">Kategori Seçiniz</option>
    @foreach ($categories as $category)
        <option value="{{ $category->id }}">{{ $category->name }}</option>
        @if ($category->categories)
            <ul>
                @foreach ($category->categories as $childCategory)
                    @include('admin.child_category', ['child_category' => $childCategory])
                @endforeach
            </ul>
        @endif
    @endforeach
</select>
child_category.blade.php
<option value="{{ $childCategory->id }}">{{ $childCategory->name }}</option>
@if ($child_category->categories)
<ul>
@foreach ($child_category->categories as $childCategory)
@include('admin.child_category', ['child_category' => $childCategory])
@endforeach
</ul>
@endif