Fix: import job class now resolved from the container.

Previously, following the instructions by binding Filament's ImportJob
class to your own subclass didn't work, since the code was newing up
a new instance of the job class itself, rather than using the container.
This commit is contained in:
Mike Scott
2024-05-25 18:11:55 +01:00
parent 0e06ba5a33
commit 543cc5a846
@@ -273,12 +273,12 @@ trait CanImportRecords
$import->unsetRelation('user');
$importJobs = collect($importChunks)
->map(fn (array $importChunk): object => new ($job)(
$import,
rows: base64_encode(serialize($importChunk)),
columnMap: $data['columnMap'],
options: $options,
));
->map(fn (array $importChunk): object => app($job, [
'import' => $import,
'rows' => base64_encode(serialize($importChunk)),
'columnMap' => $data['columnMap'],
'options' => $options,
]));
$importer = $import->getImporter(
columnMap: $data['columnMap'],