createOptionForm is not saving the created record

Hello.
I have a relatively complex form to create dossiers. One on the fields of that dossier is person_id (decedent_id) which comes from the resource people. I have used the createOptionForm to have the possibility to create a new person in modal form without leaving the dossier create form.

Everything looks fine, but it gives an error: Select field [data.decedent_id] must have a [createOptionUsing()] closure set.

If I use that createOptionUsing like this:
                                ->createOptionUsing( function (Get $get) {
                                    $get('id');
                                })

it does nothing. I mean, it does NOT CREATE the new person record (thowing no errors at all).

I do not have a relationship between dossier and people for just one field of decedent person. Is a relationship a MUST-HAVE for a modal create form with createOptionForm?

Any ideas of how to get along this?

Thanks.

I do not write all the code, because it is too long, but the main part is:

 Select::make('decedent_id')
                                ->label(__('decedent_id'))
                                ->required()
                                ->options(DB::table('people')->select('id', DB::raw("CONCAT(people.full_name,' (',people.doc_num,') ',COALESCE(DATE_FORMAT(people.date_of_death,'%d-%b-%Y', 'es_es'),'sin fecha fallecimiento')) AS full_name"))->get()->pluck('full_name', 'id'))
                               


Any help will be highly appreciated. I am really stuck here.
Tks.
image.png
image.png
Was this page helpful?