diff --git a/packages/widgets/docs/02-stats-overview.md b/packages/widgets/docs/02-stats-overview.md index 0b46b8da3e..982a64874a 100644 --- a/packages/widgets/docs/02-stats-overview.md +++ b/packages/widgets/docs/02-stats-overview.md @@ -101,7 +101,7 @@ protected function getStats(): array } ``` -Note: the escaping of the $ in $dispatch is intentional. This is a Livewire event, not a PHP variable. +In this example, we are deliberately escaping the `$` in `$dispatch()` since this needs to be passed directly to the HTML, it is not a PHP variable. ## Adding a chart to a stat @@ -146,83 +146,3 @@ To disable this behavior, you may override the `$isLazy` property on the widget ```php protected static bool $isLazy = true; ``` - -## Example - -Given you have an OrderResource, to display an OrdersOverview widget above the table which sets a 'processed' filter on -the table, the Widget would be: - -```php -color('success') - ->extraAttributes([ - 'class' => 'cursor-pointer', - 'wire:click' => "\$dispatch('setStatusFilter', {filter: 'processed'})", - ]), - // ... - ]; - } -} -``` - -To listen for the **setStatusFilter** event, the ListOrder class would be: - -```php -tableFilters[$filter]['isActive'] = true; - } - - protected function getHeaderActions(): array - { - return [ - CreateAction::make(), - ]; - } - - protected function getHeaderWidgets(): array - { - return [ - OrderResource\Widgets\OrdersOverview::class, - ]; - } -} -``` - -Note the new Livewire v3 `#[On...` syntax for listening for events.