form field not resetting + update data

public function table(Table $table): Table
    {
        return $table
            ->columns([
                TextColumn::make('question'),
            ])
            ->actions([
                Action::make('Reply')
                    ->form([
                        TextInput::make('replyMessage')
                            ->required()
                            ->live()
                    ])
                    ->modalContent(function (ChatSession $record, Action $action) {
                        return view(
                            'filament.chat-messages.chats',
                            ['chatSession' => $record],
                        );
                    })

                    ->extraModalFooterActions(fn(Action $action): array => [
                        $action->makeModalSubmitAction('Reply', arguments: ['halt' => true]),
                    ])
                    ->action(function ($action, ChatSession $record, array $data, $arguments, Set $set, Get $get) {
                        $chatMessageService = new ChatMessageService();
                        $chatMessageService->create($record->id,$data['replyMessage'],auth()->user()->id,true);
                        
                        if ($arguments['halt'] === true) {
                            $action->halt();
                        }
                    })
                    ->slideOver()
                    ->modalSubmitAction(false)
            ]);
    }

  1. How can I reset the value of replyMessage field? $set , $this->form->fill(); $this->reset('replyMessage') - all 3 are not working when written above halt() and anything written after halt doesnt get executed.
  2. This custom view (filament.chat-messages.chats), loads the chat message of a user & admin. I am dispatching an event from livewire from the frontend, how can I listen to that event of a new message so that the messages get updated in this modal?
Was this page helpful?