F
Filament13mo ago
core

select not getting live() input

I am trying to use reactive (live() inputs inside a wizard form and in it I have a repeater , for some reason I get null for
Select::make('cuisine_id')
->required()
->relationship('cuisines', 'name')
->live(),
Select::make('cuisine_id')
->required()
->relationship('cuisines', 'name')
->live(),
Wizard\Step::make('Group Recipes')
->schema([
Repeater::make('recipes')
->relationship('recipes')
->schema([
Select::make('recipe_id')
->searchable()
->options(function (Get $get): Collection {
$cuisineId = $get('cuisine_id');
\Log::info('Cuisine ID:', [$get('cuisine_id')]);
if ($cuisineId) {
return Recipe::query()
->where('cuisine_id', $cuisineId)
->pluck('title', 'id');
}
}),
Wizard\Step::make('Group Recipes')
->schema([
Repeater::make('recipes')
->relationship('recipes')
->schema([
Select::make('recipe_id')
->searchable()
->options(function (Get $get): Collection {
$cuisineId = $get('cuisine_id');
\Log::info('Cuisine ID:', [$get('cuisine_id')]);
if ($cuisineId) {
return Recipe::query()
->where('cuisine_id', $cuisineId)
->pluck('title', 'id');
}
}),
1 Reply
3rgo
3rgo13mo ago
$get is automatically scope to the current repeater item. Please see this section of the documentation on how to access parent field values : https://filamentphp.com/docs/3.x/forms/fields/repeater#using-get-to-access-parent-field-values
Want results from more Discord servers?
Add your server