Skip to content

Commit 9403e71

Browse files
committed
using model primary key function for execute Actions parameter instead hardcoded with id column
1 parent 2c291db commit 9403e71

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

resources/views/components/action.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
$class = 'flex hover:text-blue-600 transition-all duration-300 ease-in-out focus:text-blue-600 active:text-blue-600"'
44
@endphp
55
@if ($action->renderIf($item))
6-
<a href="#!" title="{{$action->title}}" wire:click.prevent="executeAction('{{ $action->id }}', '{{ $item->id }}', true)" class="{{ $class }}">
6+
<a href="#!" title="{{$action->title}}" wire:click.prevent="executeAction('{{ $action->id }}', '{{ $item->getKey() }}', true)" class="{{ $class }}">
77
{{ $slot }}
88
</a>
99
@endif

resources/views/components/actions.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
@foreach ($actions as $action)
1313
@if ($action->renderIf($model))
14-
<a href="#!" wire:click.prevent="executeAction('{{ $action->id }}', '{{ $model->id }}', true)" title="{{ $action->title}}" class="group flex items-center px-4 py-2 text-gray-700 hover:bg-gray-100 hover:text-gray-900">
14+
<a href="#!" wire:click.prevent="executeAction('{{ $action->id }}', '{{ $model->getKey() }}', true)" title="{{ $action->title}}" class="group flex items-center px-4 py-2 text-gray-700 hover:bg-gray-100 hover:text-gray-900">
1515
<i data-feather="{{ $action->icon }}" class="mr-3 h-4 w-4 text-gray-600 group-hover:text-gray-700"></i>
1616
{{ $action->title }}
1717
</a>
@@ -24,7 +24,7 @@
2424
<div class="hidden lg:flex justify-items-end">
2525
@foreach ($actions as $action)
2626
@if ($action->renderIf($model))
27-
<x-lv-icon-button :icon="$action->icon" size="sm" wire:click.prevent="executeAction('{{ $action->id }}', '{{ $model->id }}', true)" />
27+
<x-lv-icon-button :icon="$action->icon" size="sm" wire:click.prevent="executeAction('{{ $action->id }}', '{{ $model->getKey() }}', true)" />
2828
@endif
2929
@endforeach
3030
</div>

0 commit comments

Comments
 (0)