Importer causing server restart

What I am trying to do: Import data from .csv file with some data modification. The .csv data only contain the object code (let's say Curriculum code) like "C13". But my database column requires the Curriculum ID, so I want to match it with the code from the.csv file and then store the ID in the database. What I did: I have an Importer class that functions to import product data from .csv. In this class I use the castStateUsing method to get the ID for the foreign key. My issue/the error: However, when I imported, the development server suddenly changed its port, which was all 8000, to 8001. And the import was not successful, and there was no error log whatsoever. Code:
ImportColumn::make('curriculum_id')
->label('Kurikulum')
->requiredMapping()
->castStateUsing(function (string $state) {
return Curriculum::firstWhere('code', $state)->id;
})
->rules(['required']),
ImportColumn::make('curriculum_id')
->label('Kurikulum')
->requiredMapping()
->castStateUsing(function (string $state) {
return Curriculum::firstWhere('code', $state)->id;
})
->rules(['required']),
1 Reply
Garadit
Garadit3mo ago
This is the Importer code