Batch Actions
Batch actions operate on selected rows.
protected function batchActions(): array
{
return [
new BatchAction('deactivate', VariantType::WARNING->value, 'Deactivate selected'),
];
}
protected function doBatchActionDeactivate(array $selectedRows): void
{
User::query()->whereKey($selectedRows)->update(['active' => false]);
}
The action name is mapped to a method named doBatchAction{Name} using ucfirst().
Invalid client-provided batch action names are ignored unless they are declared in batchActions().