konradkalemba / blade-components-scoped-slots

Scoped slots feature addition to Laravel's Blade templating engine
MIT License
27 stars 6 forks source link

enhance so that scopedslots can be nested #5

Open huiyang opened 1 year ago

huiyang commented 1 year ago

enable the nested usage, eg:

@foreach($itemGroups as $items)
    @foreach($items as $itemData)
        {{ $group($item($itemData)) }}
    @endforeach
@endforeach
@component('component', ['itemGroups' => $itemGroups])
    @scopedslot('group', ($slot)) 
        <div class="card card-body">
            {{ $slot }}
        </div>
    @endscopedslot

    @scopedslot('item', ($item))
        Item: {{ $item->id }}
    @endscopedslot
@endcomponent