Skip to content

Commit b3d24ef

Browse files
committed
Fix bulk select with search
1 parent ed03c58 commit b3d24ef

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/Traits/WithBulkActions.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,12 @@ public function resetBulk(): void
6767
/**
6868
* @return Builder|Relation
6969
*/
70-
public function selectedRowsQuery()
70+
public function selectedRowsQuery(): Relation|Builder
7171
{
72-
return (clone $this->rowsQuery())
73-
->unless($this->selectAll, fn ($query) => $query->whereIn($query->qualifyColumn($this->primaryKey), $this->selected));
72+
return $this->query()->unless(
73+
$this->selectAll,
74+
fn ($query) => $query->whereIn($query->qualifyColumn($this->primaryKey), $this->selected)
75+
);
7476
}
7577

7678
/**
@@ -83,7 +85,7 @@ public function getSelectedRowsQueryProperty()
8385

8486
public function selectedKeys(): array
8587
{
86-
return $this->selectedRowsQuery()->pluck($this->rowsQuery()->qualifyColumn($this->primaryKey))->toArray();
88+
return $this->selectedRowsQuery()->pluck($this->query()->qualifyColumn($this->primaryKey))->toArray();
8789
}
8890

8991
public function getSelectedKeysProperty(): array

0 commit comments

Comments
 (0)