F
Filament8mo ago
Bonux

Using Import action in Wizard and creating import action records for a relational record

First of all, is it possible to add import action to steps?
protected function getSteps(): array
{
return [
Step::make('Job settings')
->schema([
Select::make('job_type')
->searchable()
->live()
->options([
'foo' => 'foo',
'bar' => 'bar',
])
]),
Step::make('Importing file')
->schema([
ImportAction::make()->importer(
// Based on job_type switch out the importer
// Could be done with match() {} if I was able to pass a callback function and get the Get $get('job_type')
)
]),
];
}
protected function getSteps(): array
{
return [
Step::make('Job settings')
->schema([
Select::make('job_type')
->searchable()
->live()
->options([
'foo' => 'foo',
'bar' => 'bar',
])
]),
Step::make('Importing file')
->schema([
ImportAction::make()->importer(
// Based on job_type switch out the importer
// Could be done with match() {} if I was able to pass a callback function and get the Get $get('job_type')
)
]),
];
}
Secondly it is possible to make the importer import data to a belongsTo relation? A Process model is made from the step wizard and Process model hasMany ProcessableRows which are improted by the ImportAction importer. I need to somehow pass Process model id to the importer action
public function resolveRecord(): ?ProcessableRows
{
????
return ProcessableRows::create([
'process_id' => $process->id
]);
}
public function resolveRecord(): ?ProcessableRows
{
????
return ProcessableRows::create([
'process_id' => $process->id
]);
}
1 Reply
Bonux
BonuxOP8mo ago
If that is not possible, perhaps we can add a headerAction to the edit page and show the improt there ? 🤔
Want results from more Discord servers?
Add your server