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')
                    )
                ]),
        ];
    }


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 
    ]);
}
Was this page helpful?