Skip to content

Commit e26b957

Browse files
committed
Fix psalm
1 parent 087bb90 commit e26b957

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

src/Traits/WithBulkActions.php

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace Rappasoft\LaravelLivewireTables\Traits;
44

5+
use Illuminate\Database\Eloquent\Builder;
6+
57
/**
68
* Trait WithBulkActions.
79
*/
@@ -41,7 +43,7 @@ public function updatedSelectPage($value): void
4143

4244
public function selectPageRows(): void
4345
{
44-
$this->selected = $this->rows->pluck($this->primaryKey)->map(fn ($id) => (string) $id);
46+
$this->selected = $this->rows->pluck($this->primaryKey)->map(fn ($key) => (string) $key);
4547
}
4648

4749
public function selectAll(): void
@@ -56,14 +58,24 @@ public function resetBulk(): void
5658
$this->selected = [];
5759
}
5860

59-
public function getSelectedRowsQueryProperty()
61+
public function selectedRowsQuery(): Builder
6062
{
6163
return (clone $this->rowsQuery())
6264
->unless($this->selectAll, fn ($query) => $query->whereKey($this->selected));
6365
}
6466

65-
public function getSelectedKeysProperty()
67+
public function getSelectedRowsQueryProperty(): Builder
68+
{
69+
return $this->selectedRowsQuery();
70+
}
71+
72+
public function selectedKeys(): array
73+
{
74+
return $this->selectedRowsQuery()->pluck($this->primaryKey)->toArray();
75+
}
76+
77+
public function getSelectedKeysProperty(): array
6678
{
67-
return $this->selectedRowsQuery->pluck($this->primaryKey)->toArray();
79+
return $this->selectedKeys();
6880
}
6981
}

0 commit comments

Comments
 (0)