Laravel Livewire Tables Documentation

🎉 Enjoying this package? Consider sponsoring me on GitHub or buying me a beer.

This is the documentation for v2 but the latest version is v3. You can switch versions in the menu at the top. Check your current version with the following command:

composer show rappasoft/laravel-livewire-tables

Processing Bulk Actions

To process your bulk action you must have a method on the component with the same name as the key in the bulk actions array:

1public array $bulkActions = [
2 'exportSelected' => 'Export',
3];
4 
5public function exportSelected()
6{
7 
8}

You have access to the selectedKeys method to grab the IDs of the rows that were selected:

1public function exportSelected()
2{
3 foreach($this->getSelected() as $item)
4 {
5 // These are strings since they came from an HTML element
6 }
7}

Resetting

After you process your action you'll probably want to reset the screen back to normal, for this you can call the clearSelected method at the end:

1public function exportSelected()
2{
3 ...
4 
5 $this->clearSelected();
6}