laravel-widgets
laravel-widgets copied to clipboard
Add getter of $widgets to WidgetGroup
Hello. Sometimes we need to have extra logic with widget groups. For example, make tabs fo them.
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="{{ $widget[1] }}" role="tab" aria-controls="home"> {{ $widget["name"] }}</a>
</li>
</ul>
<div class="tab-content">
{{ Widget::group('group')->display() }}
</div>
So we need to loop over widgets in group. It would be great to have getter or use Macroable trait on Widget group.
The idea to make widgets in group iteratable is cool, but it's not easy due to internal widget group implementation widgets in a group are instantiated and sorted only in display()
method.
This implementation can probably be changed without big BC breaks though
I understand. Thank you for reply.