diff --git a/src/AbstractModelRecordImport.php b/src/AbstractModelRecordImport.php index 4a95146..20ebdfc 100644 --- a/src/AbstractModelRecordImport.php +++ b/src/AbstractModelRecordImport.php @@ -9,17 +9,15 @@ use Maatwebsite\Excel\Concerns\Importable; use Maatwebsite\Excel\Concerns\WithEvents; use Illuminate\Contracts\Queue\ShouldQueue; +use Maatwebsite\Excel\Concerns\WithStartRow; use Illuminate\Foundation\Bus\PendingDispatch; -use Maatwebsite\Excel\Concerns\WithHeadingRow; use FromHome\ModelUpload\Models\ModelUploadFile; use Maatwebsite\Excel\Concerns\WithBatchInserts; use Maatwebsite\Excel\Concerns\WithChunkReading; use Maatwebsite\Excel\Concerns\SkipsUnknownSheets; -use Maatwebsite\Excel\Concerns\WithMultipleSheets; -use Maatwebsite\Excel\Concerns\WithCustomStartCell; use FromHome\ModelUpload\Jobs\ProcessModelRecordJob; -abstract class AbstractModelRecordImport implements ShouldQueue, SkipsUnknownSheets, WithBatchInserts, WithChunkReading, WithCustomStartCell, WithEvents, WithHeadingRow, WithMultipleSheets +abstract class AbstractModelRecordImport implements ShouldQueue, SkipsUnknownSheets, WithBatchInserts, WithChunkReading, WithStartRow, WithEvents { use Importable; @@ -72,19 +70,10 @@ public function registerEvents(): array ]; } - public function sheets(): array - { - return [ - 'DATA' => $this, - ]; - } - - public function onUnknownSheet($sheetName): void - { - } + public function onUnknownSheet($sheetName): void {} - public function startCell(): string + public function startRow(): int { - return ModelUpload::importStartCell(); + return ModelUpload::importStartRow(); } } diff --git a/src/ModelUpload.php b/src/ModelUpload.php index 0bd1834..cd94e81 100755 --- a/src/ModelUpload.php +++ b/src/ModelUpload.php @@ -13,16 +13,16 @@ final class ModelUpload { - private static string $importStartCell = 'A1'; + private static int $importStartRow = 1; - public static function importStartCell(): string + public static function importStartRow(): int { - return self::$importStartCell; + return self::$importStartRow; } - public static function useImportStartCell(string $importStartCell): void + public static function useImportStartRow(int $importStartRow): void { - self::$importStartCell = $importStartCell; + self::$importStartRow = $importStartRow; } /** @@ -55,7 +55,10 @@ public static function storeModelUploadFile(Request $request, array $meta = [], $file = $request->file('file'); return $action->handle( - $request->user(), $file, $modelType ?? $request->input('model_type'), $meta + $request->user(), + $file, + $modelType ?? $request->input('model_type'), + $meta ); } }