How to use callable $get in createOptionForm()

I want to call a reactive component outside the createOptionForm() component, but it shows null. Help please
Solution:
->default(fn ($livewire) => dd($livewire->data['product_id']))
->default(fn ($livewire) => dd($livewire->data['product_id']))
...
Jump to solution
5 Replies
LeandroFerreira
LeandroFerreira17mo ago
what code did you try?
ℬℴ𝒿𝒿𝒾
ℬℴ𝒿𝒿𝒾OP17mo ago
Select::make('product_id')
->reactive(),

Select::make('category_id')
->relationship('category', 'name')
->createOptionForm([
TextInput::make('name'),
Hidden::make('id')
->default(fn (callable $get) => dd($get('product_id')))
])
Select::make('product_id')
->reactive(),

Select::make('category_id')
->relationship('category', 'name')
->createOptionForm([
TextInput::make('name'),
Hidden::make('id')
->default(fn (callable $get) => dd($get('product_id')))
])
it shows null
toeknee
toeknee17mo ago
You need to move out of category id so: $get('../product_id')
Solution
LeandroFerreira
LeandroFerreira17mo ago
->default(fn ($livewire) => dd($livewire->data['product_id']))
->default(fn ($livewire) => dd($livewire->data['product_id']))
ℬℴ𝒿𝒿𝒾
ℬℴ𝒿𝒿𝒾OP17mo ago
this one work! thank you very much
Want results from more Discord servers?
Add your server