Introducing Laravel Quizzes! Play now

Laravel Livewire Tables Documentation

This is the documentation for v2. 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:

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

public function exportSelected()
{

}

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

public function exportSelected()
{
    foreach($this->getSelected() as $item)
    {
        // These are strings since they came from an HTML element
    }
}

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:

public function exportSelected()
{
    ...

    $this->clearSelected();
}