// Select Component
Select::make('form_type_id')
->label('Form Türü')
->options(function ($livewire) {
$arr = [];
foreach ($livewire->getParentRecord()->forms as $form) {
$arr[$form->id] = $form->name;
}
return $arr;
})
->preload()
->live()
->required()
->native(false)
->columnSpan([
'lg' => 3,
'default' => 'full',
]),
// Dynamically set Section
Section::make()
->id('form_answers_section')
->schema(function (Get $get) use ($schema) {
$formType = $get('form_type_id');
if (blank($formType)) {
return [];
}
$formSchema = GroupFormTypes::find($formType)->form->schema;
return FormBuilder::make($formSchema)
->fileUploaderModel($schema->getRecord())->adminPreview()->build();
})
->columns([
'default' => 10
])
->columnSpanFull()
->id('form_answers')
->key('form_answers') // https://github.com/filamentphp/filament/issues/18008
->statePath('form_answers')
// Select Component
Select::make('form_type_id')
->label('Form Türü')
->options(function ($livewire) {
$arr = [];
foreach ($livewire->getParentRecord()->forms as $form) {
$arr[$form->id] = $form->name;
}
return $arr;
})
->preload()
->live()
->required()
->native(false)
->columnSpan([
'lg' => 3,
'default' => 'full',
]),
// Dynamically set Section
Section::make()
->id('form_answers_section')
->schema(function (Get $get) use ($schema) {
$formType = $get('form_type_id');
if (blank($formType)) {
return [];
}
$formSchema = GroupFormTypes::find($formType)->form->schema;
return FormBuilder::make($formSchema)
->fileUploaderModel($schema->getRecord())->adminPreview()->build();
})
->columns([
'default' => 10
])
->columnSpanFull()
->id('form_answers')
->key('form_answers') // https://github.com/filamentphp/filament/issues/18008
->statePath('form_answers')