Headers, Row Actions, and Bulk Actions
Headers
Return Header instances from header():
use RealZone22\PenguTables\Table\Header;
public function header(): array
{
return [
Header::make('<x-button>Create user</x-button>'),
Header::make('<a href="/users/import">Import</a>'),
];
}
Header content is rendered as Blade. Only use trusted templates or content generated by your application.
Row actions
Create a row action with Action::make():
use RealZone22\PenguTables\Table\Action;
Column::actions('Actions', function ($user): array {
return [
Action::make(
'<a href="/users/'.$user->id.'/edit">Edit</a>'
),
Action::make(
'<button type="button" onclick="deleteUser('.$user->id.')">Delete</button>'
),
];
});
The callback passed to Column::actions() receives the current model. It must
return an array of Action instances.
Bulk actions
use RealZone22\PenguTables\Table\BulkAction;
public function bulkActions(): array
{
return [
BulkAction::make('Mark as verified', function ($rows): void {
$rows->each->update([
'email_verified_at' => now(),
]);
}),
];
}
The callback receives an Eloquent collection of selected models. It is called when the user clicks the action.
Select-All behavior
Select-All applies to all rows matching the current search and filters, not just the current pagination page. For large data sets, PenguTables does not serialize every selected ID into Livewire state. Explicitly deselected rows are tracked separately.
Action labels
Bulk action labels are used as the action identifier in the default view. Keep labels unique within a table.