F
Filament3mo ago
Tieme

Import, before action

Hi All, I'm trying to import a CSV, the problem with the CSV is that there are no identifiers for updating a record. Now i'm looking for a action before the importer runs to remove all data already availible in the DB so the new data will be leading and old data is remove. Is there any action or function for this or do i need to modify the Filament\Actions\Imports\Jobs\ImportCsv job? If i need to change the ImportCsv job, where do i need to add the remove from DB in following function (https://github.com/filamentphp/filament/blob/56a175a12909e8c76c423a50c90c1d507493d2e4/packages/actions/src/Imports/Jobs/ImportCsv.php#L62-L125). Thanks for any help!
1 Reply
Tieme
TiemeOP3mo ago
For now i use the before action on the importAction
->before(function () {
Staffelprijzen::query()->delete();
}),
->before(function () {
Staffelprijzen::query()->delete();
}),
Not as reliable as i want, but does the job.
Want results from more Discord servers?
Add your server