requiredMapping() ->exampleHeader('Line Name') ->label('Line Name') ->rules(['required']), ImportColumn::make('type') ->requiredMapping() ->exampleHeader('Line Type') ->label('Line Type') ->rules(['required']), ImportColumn::make('plant') ->requiredMapping() ->exampleHeader('Plant Name') ->label('Plant Name') ->relationship(resolveUsing:'name') ->rules(['required']), ]; } public function resolveRecord(): ?Line { // return Line::firstOrNew([ // // Update existing records, matching them by `$this->data['column_name']` // 'email' => $this->data['email'], // ]); return new Line(); } public static function getCompletedNotificationBody(Import $import): string { $body = 'Your line 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; } }