The aim of this project is to provide a useful boilerplate with sane defaults for building backoffice tables, while allowing easy customization.
wire-table requires PHP >= 8.1 and Laravel >= 10.0
composer require livewire/livewire:^3.0 tiknil/wire-tableNote
Since v1.0.0, wire-table requires livewire 3.0. Use v0.3.2 if you are supporting livewire 2
Optional you can publish wire-table files for further customization:
php artisan vendor:publish --tag=wiretable:config # Config file
php artisan vendor:publish --tag=wiretable:views # Blade views
php artisan vendor:publish --tag=wiretable:lang # Lang translation filesCreate a new component using the make:wiretable command:
php artisan make:wiretable UsersTableThe UsersTable class will be created inside your app/Livewire folder.
A basic table:
class UsersTable extends WireTable
{
public function query(): Builder
{
return User::query();
}
public function columns(): array
{
return [
Column::create(
label: __('backend.created_at'),
key: 'created_at',
sort: true
),
Column::create(
label: __('backend.name'),
key: 'name',
sort: true
),
Column::create(
label: __('backend.email'),
key: 'email',
sort: true
),
];
}
}Include it in your blade file:
<livewire:users-table />
Remember to include the livewire javascript and css in every page where you will be using it.
The tables are just livewire components, so the official livewire documentation applies here.
See the docs folder for the full documentation.
Quick links:
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.
This package was generated using the Laravel Package Boilerplate, following the laravelpackage.com documentation.