APG
APG
FFilament
Created by APG on 6/2/2024 in #❓┊help
Using $get / $set with a Livewire::make() form component
I am desperately trying to create a modal with a select component that, when changed, can display some calculated things in the modal based on the selected amount. This works to pass the default state of amount from coverage_amount, but amount doesn't change when the select field changes. How can I access the current state of coverage_amount inside the PolicyPreview livewire component?
->form([
Select::make('coverage_amount')
->label('Amount')
->options(fn (CourtCase $case) => $case->getCoverageOptions())
->default(fn (CourtCase $case) => $case->firmRequestedDefaultCoverage())
->placeholder('Select coverage amount')
->live(),
Livewire::make(PolicyPreview::class)
->data(fn (Get $get) => [
'amount' => $get('coverage_amount'),
]),
])
->form([
Select::make('coverage_amount')
->label('Amount')
->options(fn (CourtCase $case) => $case->getCoverageOptions())
->default(fn (CourtCase $case) => $case->firmRequestedDefaultCoverage())
->placeholder('Select coverage amount')
->live(),
Livewire::make(PolicyPreview::class)
->data(fn (Get $get) => [
'amount' => $get('coverage_amount'),
]),
])
7 replies