Laravel Livewire Tables Documentation

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

This is the documentation for v1 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

Creating bulk actions

To create bulk actions, you must specify a method and a button title in the $bulkActions component property.

1public array $bulkActions = [
2 'exportSelected' => 'Export',
3];

The following method is only available in v1.16 and above

As of v1.16 you can define bulk action with a method, so you can perform other actions to determine what your actions are or perform translations on the strings:

1public function bulkActions(): array
2{
3 // Figure out what actions the admin gets
4 ...
5 
6 return [
7 'activate' => __('Activate'),
8 'deactivate' => __('Deactivate'),
9 ];
10}

The key is the Livewire method to call, and the value is the name of the item in the bulk actions dropdown.

You can define your method to do whatever you want:

1public function exportSelected()
2{
3 // Do something with the selected rows.
4}

See Getting the selected rows query or Getting the selected keys to understand how to work with the selected data.