F
Filament2mo ago
Ali

Weird Importer

The CSV file has 169179 lines, with duplicates (169030 without), after importing it with
public static function getChunkSize(): int
{
return 100;
}

public static function getColumns(): array
{
return [
'reference' => ImportColumn::make('reference')
->requiredMapping()
->rules(['required', 'max:255']),
];
}

public function resolveRecord(): ?Driver
{
return Driver::firstOrNew([
// Update existing records, matching them by `$this->data['column_name']`
'reference' => $this->data['reference'],
]);

// return new Driver();
}

public static function getCompletedNotificationBody(Import $import): string
{
$body = 'Your driver import has completed and ' . number_format($import->successful_rows) . ' ' . str('row')->plural($import->successful_rows) . ' imported.';

if ($failedRowsCount = $import->getFailedRowsCount()) {
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to import.';
}

return $body;
}
public static function getChunkSize(): int
{
return 100;
}

public static function getColumns(): array
{
return [
'reference' => ImportColumn::make('reference')
->requiredMapping()
->rules(['required', 'max:255']),
];
}

public function resolveRecord(): ?Driver
{
return Driver::firstOrNew([
// Update existing records, matching them by `$this->data['column_name']`
'reference' => $this->data['reference'],
]);

// return new Driver();
}

public static function getCompletedNotificationBody(Import $import): string
{
$body = 'Your driver import has completed and ' . number_format($import->successful_rows) . ' ' . str('row')->plural($import->successful_rows) . ' imported.';

if ($failedRowsCount = $import->getFailedRowsCount()) {
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to import.';
}

return $body;
}
I got the filament notification AND the table count rows not the same number, no error on the notification and no logs, what can I do ?
No description
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?