I'm encountering a bug in form Repeater?

I have a repeater that creates a Select field, the options array for the repeater should be dynamically updated based on other form fields:
Select::make('panel_insert')
->options(function (callable $get) {
$panels = Panel::where('manufacturer_id',$get('manufacturer'))
->where('use', $get('use'))
->whereHas('panelType', function ($query){
$query->where('insertable', TRUE);
})
->get();
$options = [];
if ($panels) {
foreach ($panels as $panel) {
$options[$panel->id] = $panel->panelType->name.", ".$panel->panelSurface->name;
}
return $options;
}
})
Select::make('panel_insert')
->options(function (callable $get) {
$panels = Panel::where('manufacturer_id',$get('manufacturer'))
->where('use', $get('use'))
->whereHas('panelType', function ($query){
$query->where('insertable', TRUE);
})
->get();
$options = [];
if ($panels) {
foreach ($panels as $panel) {
$options[$panel->id] = $panel->panelType->name.", ".$panel->panelSurface->name;
}
return $options;
}
})
The issue is that $get('manufacturer') and $get('use') returns null in the closure, even though they are non-empty fields. The code works in other fields (this is a copy-paste of another, similar field). I tested the closure and it returns the expected select options when the correct ids are returned. My issue is that $get('field_value') is always empty in the Repeater closure. Any ideas? Thanks
5 Replies
rominronin
rominronin15mo ago
For what it's worth, dd in the closure kills the process, but doesn't show any dumped information.
RickDB
RickDB15mo ago
Is it a parent field you are trying to get?
RickDB
RickDB15mo ago
Did this work for you @rominronin?
rominronin
rominronin15mo ago
Yes, thank you very much @rickdb