Anvil
Anvil - The mobile companion for Laravel Forge. Available now. Download for iOS

Selected keys

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:

1public function exportSelected()
2{
3 if (count($this->selectedKeys)) {
4 // Do something with the selected rows
5 dd($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.