Skip to content

Commit

Permalink
Merge pull request #5522 from Laravel-Backpack/livewire-widget-key
Browse files Browse the repository at this point in the history
Attribute to set `key` to livewire widget.
  • Loading branch information
pxpm committed May 20, 2024
2 parents 7ddec50 + b23c83e commit f2257fe
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/resources/views/ui/widgets/livewire.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
@includeWhen(!empty($widget['wrapper']), backpack_view('widgets.inc.wrapper_start'))

<div class="{{ $widget['class'] ?? 'card' }}" @foreach($widget['attributes'] ?? [] as $key => $value) {{ $key }}="{{ $value }}" @endforeach>
@livewire($widget['content'], $widget['parameters'] ?? [])
@if(isset($widget['key']))
@livewire($widget['content'], $widget['parameters'] ?? [], key($widget['key']))
@else
@livewire($widget['content'], $widget['parameters'] ?? [])
@endif
</div>

@includeWhen(!empty($widget['wrapper']), backpack_view('widgets.inc.wrapper_end'))
Expand All @@ -15,7 +19,7 @@
@pushOnce('after_styles')
@livewireStyles
@endPushOnce

@pushOnce('after_scripts')
@livewireScripts
@endpushOnce
Expand Down

0 comments on commit f2257fe

Please sign in to comment.