Dispatch Event on AfterStateUpdated()

Hello,

Does anyone know how to dispatch event for example to update-counter within main resource? Like we have $this->dispatch in Livewire components and in List,Edit filament classes, I need kind-a same thing but within main resource..

protected static function getStatusColumn (): Tables\Columns\SelectColumn
    {
        return Tables\Columns\SelectColumn::make('status')
            ->label(__("inputs.status"))
            ->options(ContactFormStatuses::class)
            ->sortable()
            ->afterStateUpdated(function($record)  {
                Notification::make()
                    ->title(__('notifications.status_updated'))
                    ->success()
                    ->send();
                $this->dispatch('update-counter');
            })
            ->visible(fn() => self::$user->can('view_status' . self::RESOURCE_PERMISSION_SUFFIX));
    }
Was this page helpful?