diff --git a/CHANGELOG.md b/CHANGELOG.md index e45450eaf..4958d0393 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ All notable changes to `laravel-livewire-tables` will be documented in this file +## [v3.4.15] - 2024-08-25 +### New Features +- BooleanColumn - Toggleable Callback by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1892 + +### Tweaks +- Doc Type Fixes by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1891 + ## [v3.4.14] - 2024-08-25 ### New Features - Set Action Position (Left/Center/Right) and Set Actions in Toolbar by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1889 diff --git a/docs/column-types/boolean_columns.md b/docs/column-types/boolean_columns.md index 8732db839..1888fa659 100644 --- a/docs/column-types/boolean_columns.md +++ b/docs/column-types/boolean_columns.md @@ -80,6 +80,46 @@ BooleanColumn::make('Active') ->yesNo() ``` +### Toggleable + +You may call a defined public function, which should live within your Table Component, to allow "toggling" against your database: + +```php +BooleanColumn::make('Active', 'status') + ->toggleable('changeStatus'), +``` + +Then your "changeStatus" method may look like +```php + public function changeStatus(int $id) + { + $item = $this->model::find($id); + $item->status = !$item->status; + $item->save(); + } +``` + +### Toggleable Confirmation Message + +You may define a confirmation message prior to executing your toggleable() method. The method will only be executed upon confirming. +```php +BooleanColumn::make('Active', 'status') + ->confirmMessage('Are you sure that you want to change the status?') + ->toggleable('changeStatus'), +``` + +Then your "changeStatus" method may look like +```php + public function changeStatus(int $id) + { + $item = $this->model::find($id); + $item->status = !$item->status; + $item->save(); + } +``` + + +### Additional Methods Please also see the following for other available methods: