FilamentF
Filament11mo ago
ddoddsr

Livewire::make() return value?

I use Livewire Component in a Filament form to select some text I need in the form.
How do I get the data back to the form?
Livewire::make(ViewResponses::class, function(GET $get) {
    return ['record' => $get('client_id')];
}),

In the ViewResponses we select the response text.
It this point I can log it.
->actions([
    \Filament\Tables\Actions\Action::make('select')
        ->action(function (Responses $record ): void {
            logger( $record->response);
        }),
    ], position: ActionsPosition::BeforeColumns
)

Is there any way to ge the value from the livewire component and use it in the calling form?
Solution
Looks like I can use $this->dispatch('response-selected', response: $record->response); along with
#[On('response-selected')]
public function updatePostList($response)
{
   $this->message_text = $response;
   // logger($response);
}
Was this page helpful?