Form Select - how can I interact with the newly created record after creation?
When creating an option from a Select field, how can I interact with the newly created record after creation? or some way that I can create it my way instead of saving automatically
Forms\Components\Select::make('user_id')
->relationship('user', 'name')
->searchable()
->createOptionForm([
Forms\Components\TextInput::make('name')
->label(('Nombre'))
->required(),
Forms\Components\TextInput::make('email')
->label(('Email'))
->required()
->email()
])
->createOptionAction(function (Forms\Components\Actions\Action $action) {
return $action
->modalHeading('new user')
->modalButton('create')
->modalWidth('lg');
})->after(function () use ($record) {
$table = TableTest::([
"id_user" => $record->id;
])
});
})
1 Reply
i solved
->createOptionAction(function (Forms\Components\Actions\Action $action)
{
return $action
->modalHeading('new pay shedule')
->modalButton('create')
->modalWidth('lg');
})->createOptionUsing(function ($data)
{
\Log::alert($data);
// Customize create
}),