If you would like access to just the selected primary keys in your bulk action method, you may use the selectedKeys property which return an array of the selected primary keys:
1publicfunctionexportSelected()
2{
3if(count($this->selectedKeys)){
4// Do something with the selected rows
5dd($this->selectedKeys);
6
7// => [
8// 1,
9// 2,
10// 3,
11// 4,
12// ]
13}
14
15// Notify there is nothing to export
16}
Note: See The primary key about where this value comes from.
Global search
Find something useful.
Start with two characters.Search the open-source catalog, article library, and code snippets.