Skip to content

Commit

Permalink
Update Lifecycle Hooks Docs (#1675)
Browse files Browse the repository at this point in the history
  • Loading branch information
lrljoe authored Mar 1, 2024
1 parent bc3d2f3 commit 56ce863
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to `laravel-livewire-tables` will be documented in this file

## UNRELEASED
### Docs
- Amend Lifecycle Hooks document to use "public" rather than "protected" methods

## [v3.2.2] - 2024-02-29
### New Features
- Add setDefaultPerPage by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1671
Expand Down
12 changes: 9 additions & 3 deletions docs/misc/lifecycle-hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,26 @@ This is called immediately after the Columns are set up
This is called immediately after the query is executed, and is passed the result from the executed query.

## Use in Traits
To use these in a trait, append the Lifecycle Hook with your trait name, e.g.
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.

```php
trait StandardTableMethods
{

protected function configuringStandardTableMethods()
public function configuringStandardTableMethods()
{
// Your standard configure() options go here, anything set here will be over-ridden by the configure() method
// For Example
$this->setColumnSelectDisabled();
}

protected function configuredStandardTableMethods()
public function configuredStandardTableMethods()
{
// Your standard configure() options go here, anything set here will override those set in the configure() method
// For Example
$this->setColumnSelectDisabled();
}

}
Expand Down

0 comments on commit 56ce863

Please sign in to comment.