lunarphp/livewire-tables
Livewire tables for Lunar PHP apps. Build sortable, searchable, paginated data tables with reusable components and Lunar-friendly defaults. Integrates cleanly with Laravel and Livewire to speed up admin/listing UIs.
Start by installing the package via Composer (composer require lunarphp/livewire-tables), then publish its config and stubs using php artisan vendor:publish --tag=livewire-tables-config. Create your first table class by extending LunarPHP\LivewireTables\Table, define columns in the columns() method (e.g., Column::make('Name', 'name')), and attach the @livewire('table') directive in a Blade view. For quick wins, scaffold a table for an existing model (e.g., User) using php artisan make:table UserTable, then wire it up by returning a query (e.g., User::query()) from the query() method.
Use Column::text(), Column::boolean(), and Column::select() for common render types—cells can be customized via closures or custom view components. Leverage filter() to define reactive filters (text, select, date) and sort() to declare sortable columns; Livewire handles state and reactivity automatically. For bulk actions, implement bulkActions() to return an array of Action objects, each tied to a call method in the table class. To keep logic clean, separate concerns: columns() for UI, query() for data fetching, and actions()/bulkActions() for business logic. Keep state minimal—rely on Livewire’s built-in reactivity instead of storing large arrays.
Column::make('Display', 'custom_column_name') for mismatches.whereHas() logic in your query() method (e.g., $query->whereHas('role', fn($q) => $q->where('name', $value))).simplePaginate() under the hood; if you need full pagination (with total count), override usePagination().filter() method names and handled in applyFilters() if overriding default behavior.How can I help you explore Laravel packages today?