@@ -14,8 +14,8 @@ trait WithBulkActions
14
14
public string $ primaryKey = 'id ' ;
15
15
public bool $ selectPage = false ;
16
16
public bool $ selectAll = false ;
17
- public $ selected = [];
18
-
17
+ public array $ selected = [];
18
+ public array $ bulkActions = [];
19
19
public bool $ hideBulkActionsOnEmpty = false ;
20
20
21
21
public function renderingWithBulkActions (): void
@@ -49,7 +49,7 @@ public function updatedSelectPage($value): void
49
49
50
50
public function selectPageRows (): void
51
51
{
52
- $ this ->selected = $ this ->rows ->pluck ($ this ->primaryKey )->map (fn ($ key ) => (string ) $ key );
52
+ $ this ->selected = $ this ->rows ->pluck ($ this ->primaryKey )->map (fn ($ key ) => (string ) $ key )-> toArray () ;
53
53
}
54
54
55
55
public function selectAll (): void
@@ -69,8 +69,10 @@ public function resetBulk(): void
69
69
*/
70
70
public function selectedRowsQuery ()
71
71
{
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
+ );
74
76
}
75
77
76
78
/**
@@ -83,7 +85,7 @@ public function getSelectedRowsQueryProperty()
83
85
84
86
public function selectedKeys (): array
85
87
{
86
- return $ this ->selectedRowsQuery ()->pluck ($ this ->rowsQuery ()->qualifyColumn ($ this ->primaryKey ))->toArray ();
88
+ return $ this ->selectedRowsQuery ()->pluck ($ this ->query ()->qualifyColumn ($ this ->primaryKey ))->toArray ();
87
89
}
88
90
89
91
public function getSelectedKeysProperty (): array
0 commit comments