How can I assign the options to a Select, when the options are inside a json?
Hello, how could I assign the options depending on the selected form but the options would be inside a json. and tried traversing it in a foreach and allocating the array but it doesn't work
Forms\Components\Select::make('form_id')
->relationship('form', 'name')
->required(),
Grid::make(1)
->schema([
Repeater::make('metrics')
->id('metrics')
->schema([
Repeater::make('variation_input_targets')
->id('variation_input_targets')
->schema([
Select::make('type_metric')
->required()
->options(function (callable $get) {
$form = ModelsForm::find($get('form_id'));
if($form){
return $form->inputs->pluck('title', 'id');
}
})->reactive(),
]),
]),
]),
2 Replies
Please read #✅┊rules and format your code