Skip to content

Commit 768fc7d

Browse files
authored
Merge pull request #13 from atfromhome/custom-start-cell
Add `WithCustomStartCell` when import
2 parents 28823d5 + 0f6952e commit 768fc7d

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/ModelRecordImport.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@
1919
use FromHome\ModelUpload\Models\ModelUploadRecord;
2020
use Maatwebsite\Excel\Concerns\SkipsUnknownSheets;
2121
use Maatwebsite\Excel\Concerns\WithMultipleSheets;
22+
use Maatwebsite\Excel\Concerns\WithCustomStartCell;
2223
use FromHome\ModelUpload\Jobs\ProcessModelRecordJob;
2324

24-
final class ModelRecordImport implements ShouldQueue, SkipsUnknownSheets, ToModel, WithBatchInserts, WithChunkReading, WithEvents, WithHeadingRow, WithMultipleSheets
25+
final class ModelRecordImport implements ShouldQueue, SkipsUnknownSheets, ToModel, WithBatchInserts, WithChunkReading, WithCustomStartCell, WithEvents, WithHeadingRow, WithMultipleSheets
2526
{
2627
use Importable;
2728

@@ -101,4 +102,9 @@ public function sheets(): array
101102
public function onUnknownSheet($sheetName): void
102103
{
103104
}
105+
106+
public function startCell(): string
107+
{
108+
return ModelUpload::importStartCell();
109+
}
104110
}

src/ModelUpload.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,18 @@
1212

1313
final class ModelUpload
1414
{
15+
private static string $importStartCell = 'A1';
16+
17+
public static function importStartCell(): string
18+
{
19+
return self::$importStartCell;
20+
}
21+
22+
public static function useImportStartCell(string $importStartCell): void
23+
{
24+
self::$importStartCell = $importStartCell;
25+
}
26+
1527
public static function registerRecordProcessors(array $processors): void
1628
{
1729
/** @var RecordProcessorManager $manager */

0 commit comments

Comments
 (0)