Override creation in Importer

My Client model does not have a foo column, however, my import file does and for some reason, it must not be removed because it will be saved in another table.

I am using the built-in importer. Is there any workaround to adjust the creation attributes? Or should I go test other import packages such as the handleRecordCreation() of konnco/filament-import?

I tried doing it in resolveRecord() but id throws an error 'Column not found foo'

public static function getColumns(): array
    {
        return [
             Import::Column::make('name'),
             Import::Column::make('contact'),
             Import::Column::make('foo'),
        ]
    }

public function resolveRecord(): ?Client
    {
        return new Client([
            'name' => $this->data['contact'],
            'contact' => $this->data['contact'],
        ]);
    }

public function afterSave(): void
    {
        Bar::create(['x' => $this->data['foo']);
    }
Was this page helpful?