diff --git a/resources/views/components/editable.blade.php b/resources/views/components/editable.blade.php
index f28a3e7b..f03e250d 100644
--- a/resources/views/components/editable.blade.php
+++ b/resources/views/components/editable.blade.php
@@ -38,7 +38,7 @@
$params = [
'theme' => data_get($theme, 'name'),
'tableName' => $tableName,
- 'id' => data_get($row, $this->realPrimaryKey),
+ 'id' => data_get($row, $primaryKey),
'dataField' => $field,
'content' => $content,
'fallback' => $fallback,
@@ -74,9 +74,9 @@
- {{ str($message)->replace($field . '.' . $row->{$this->realPrimaryKey}, $field) }}
+ {{ str($message)->replace($field . '.' . $row->{$primaryKey}, $field) }}
@enderror
@endif
diff --git a/resources/views/components/frameworks/bootstrap5/editable.blade.php b/resources/views/components/frameworks/bootstrap5/editable.blade.php
index cb10b876..4f9bec84 100644
--- a/resources/views/components/frameworks/bootstrap5/editable.blade.php
+++ b/resources/views/components/frameworks/bootstrap5/editable.blade.php
@@ -1,6 +1,6 @@
@includeIf(data_get($setUp, 'detail.viewIcon'))
diff --git a/resources/views/components/frameworks/bootstrap5/toggleable.blade.php b/resources/views/components/frameworks/bootstrap5/toggleable.blade.php
index 91a5085d..c7b74726 100644
--- a/resources/views/components/frameworks/bootstrap5/toggleable.blade.php
+++ b/resources/views/components/frameworks/bootstrap5/toggleable.blade.php
@@ -1,6 +1,6 @@
@php
$params = [
- 'id' => data_get($row, $this->realPrimaryKey),
+ 'id' => data_get($row, $primaryKey),
'isHidden' => !$showToggleable,
'tableName' => $tableName,
'field' => $column->field,
diff --git a/resources/views/components/frameworks/tailwind/editable.blade.php b/resources/views/components/frameworks/tailwind/editable.blade.php
index 24ffb43a..67e0bc55 100644
--- a/resources/views/components/frameworks/tailwind/editable.blade.php
+++ b/resources/views/components/frameworks/tailwind/editable.blade.php
@@ -1,6 +1,6 @@
@includeIf(data_get($setUp, 'detail.viewIcon'))
diff --git a/resources/views/components/frameworks/tailwind/toggleable.blade.php b/resources/views/components/frameworks/tailwind/toggleable.blade.php
index 9d7103a9..450d767a 100644
--- a/resources/views/components/frameworks/tailwind/toggleable.blade.php
+++ b/resources/views/components/frameworks/tailwind/toggleable.blade.php
@@ -5,7 +5,7 @@
$falseValue = $column->toggleable['default'][1];
$params = [
- 'id' => data_get($row, $this->realPrimaryKey),
+ 'id' => data_get($row, $primaryKey),
'isHidden' => !$showToggleable,
'tableName' => $tableName,
'field' => $column->field,
diff --git a/resources/views/components/row.blade.php b/resources/views/components/row.blade.php
index f3eb4e84..76bb85cd 100644
--- a/resources/views/components/row.blade.php
+++ b/resources/views/components/row.blade.php
@@ -71,7 +71,7 @@
@if(empty(data_get($row, 'actions')) && $column->isAction)
@if (method_exists($this, 'actionsFromView') && $actionsFromView = $this->actionsFromView($row))
-
+
{!! $actionsFromView !!}
@endif
@@ -80,7 +80,7 @@
@if (filled(data_get($row, 'actions')) && $column->isAction)
@foreach (data_get($row, 'actions') as $key => $action)
@if(filled($action))
-
+
{!! $action !!}
@endif
@@ -92,7 +92,7 @@
$hasFieldRules = $actionRulesClass->recoverActionForField($row, $field);
// =============* Edit On Click *=====================
-
+
$showEditOnClick = false;
if (data_get($column->editable, 'hasPermission')) {
@@ -125,7 +125,7 @@
$showEditOnClick = false;
}
@endphp
-
+
@if($showEditOnClick === true)
@include(data_get($theme, 'editable.view') ?? null, ['editable' => $column->editable])
diff --git a/resources/views/components/table.blade.php b/resources/views/components/table.blade.php
index ed09b71c..d0d5b15f 100644
--- a/resources/views/components/table.blade.php
+++ b/resources/views/components/table.blade.php
@@ -29,7 +29,7 @@
@php throw new Exception('To use checkboxes, you must define a unique key attribute in your data source.') @endphp
@endif
@php
- $rowId = data_get($row, $this->realPrimaryKey);
+ $rowId = data_get($row, $primaryKey);
$class = data_get($theme, 'table.trBodyClass');
@@ -96,7 +96,7 @@
@if (filled($rulesValues['detailView']))
- @includeWhen(data_get($setUp, 'detail.state.' . $row->{$this->realPrimaryKey}),
+ @includeWhen(data_get($setUp, 'detail.state.' . $row->{$primaryKey}),
$rulesValues['detailView'][0]['detailView'],
[
- 'id' => data_get($row, $this->realPrimaryKey),
+ 'id' => data_get($row, $primaryKey),
'options' => array_merge(
data_get($setUp, 'detail.options'),
$rulesValues['detailView']['0']['options']),
]
)
@else
- @includeWhen(data_get($setUp, 'detail.state.' . $row->{$this->realPrimaryKey}),
+ @includeWhen(data_get($setUp, 'detail.state.' . $row->{$primaryKey}),
data_get($setUp, 'detail.view'),
[
- 'id' => data_get($row, $this->realPrimaryKey),
+ 'id' => data_get($row, $primaryKey),
'options' => data_get($setUp, 'detail.options'),
]
)
diff --git a/src/Concerns/Base.php b/src/Concerns/Base.php
index 5513c28f..c31ea2be 100644
--- a/src/Concerns/Base.php
+++ b/src/Concerns/Base.php
@@ -2,15 +2,12 @@
namespace PowerComponents\LivewirePowerGrid\Concerns;
-use Livewire\Attributes\Computed;
use PowerComponents\LivewirePowerGrid\ProcessDataSource;
trait Base
{
public string $primaryKey = 'id';
- public ?string $primaryKeyAlias = null;
-
public bool $ignoreTablePrefix = true;
public string $tableName = 'default';
@@ -47,12 +44,6 @@ trait Base
public int $totalCurrentPage = 0;
- #[Computed]
- public function realPrimaryKey(): string
- {
- return $this->primaryKeyAlias ?? $this->primaryKey;
- }
-
public function template(): ?string
{
return null;
diff --git a/src/Concerns/ToggleDetail.php b/src/Concerns/ToggleDetail.php
index f670bcdd..f6e08605 100644
--- a/src/Concerns/ToggleDetail.php
+++ b/src/Concerns/ToggleDetail.php
@@ -29,9 +29,7 @@ private function resolveDetailRow(mixed $results): void
$collection = !is_array($results) && method_exists($results, 'items') ? collect($results->items()) : collect($results);
}
- $primaryKey = $this->primaryKeyAlias ?? $this->primaryKey;
-
- $collection->pluck($primaryKey)
+ $collection->pluck($this->primaryKey)
->map(fn ($id) => strval($id))
->each(function ($id) {
$state = data_get($this->setUp, "detail.state.$id", false);