Laravel Livewire Tables Documentation

🎉 Enjoying this package? Consider sponsoring me on GitHub or buying me a beer.

This is the documentation for v3. You can switch versions in the menu at the top. Check your current version with the following command:

composer show rappasoft/laravel-livewire-tables

Lifecycle Hooks

With the migration to Livewire 3, there we are implementing several Lifecycle Hooks to assist with re-using methods across multiple Table Components.

You may use these either in your Table Component, or in a trait

configuring

This is called immediately prior to the configure() method being called. This will be overridden by anything you define in configure()

configured

This is called immediately after the configure() method is called. This will override anything you define in configure()

settingColumns

This is called prior to setting up the available Columns via the columns() method

columnsSet

This is called immediately after the Columns are set up

configuringColumnSelect

This is called immediately prior to setting up Column Select

configuredColumnSelect

This is called immediately after setting up Column Select

rowsRetrieved

This is called immediately after the query is executed, and is passed the result from the executed query.

searchUpdated

This is called whenever the search is updated, and is passed the value that has been searched for

filterApplying

This is called whenever a Filter is applying

filterReset

This is called whenever a Filter is reset

filterSet

This is called whenever a Filter is set

filterUpdated

This is called whenever a Filter is updated/used

filterRemoved

This is called whenever a Filter is removed from the table

Use in Traits

To use these in a trait, allowing you to easily set defaults across multiple tables, you should ensure that you append the Lifecycle Hook with your trait name, e.g.

You can then add the trait to your tables, allowing you to centralise your defaults, and avoid code duplication.

1trait StandardTableMethods
2{
3 
4 public function configuringStandardTableMethods()
5 {
6 // Your standard configure() options go here, anything set here will be over-ridden by the configure() method
7 // For Example
8 $this->setColumnSelectDisabled();
9 }
10 
11 public function configuredStandardTableMethods()
12 {
13 // Your standard configure() options go here, anything set here will override those set in the configure() method
14 // For Example
15 $this->setColumnSelectDisabled();
16 }
17 
18}