Skip to content

Commit 8c8ea4d

Browse files
authored
Merge pull request #21 from anshour/main
Fixing bug and some adjustments
2 parents a270dc9 + 7b2f8c2 commit 8c8ea4d

File tree

2 files changed

+14
-22
lines changed

2 files changed

+14
-22
lines changed

src/AbstractModelRecordImport.php

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,15 @@
99
use Maatwebsite\Excel\Concerns\Importable;
1010
use Maatwebsite\Excel\Concerns\WithEvents;
1111
use Illuminate\Contracts\Queue\ShouldQueue;
12+
use Maatwebsite\Excel\Concerns\WithStartRow;
1213
use Illuminate\Foundation\Bus\PendingDispatch;
13-
use Maatwebsite\Excel\Concerns\WithHeadingRow;
1414
use FromHome\ModelUpload\Models\ModelUploadFile;
1515
use Maatwebsite\Excel\Concerns\WithBatchInserts;
1616
use Maatwebsite\Excel\Concerns\WithChunkReading;
1717
use Maatwebsite\Excel\Concerns\SkipsUnknownSheets;
18-
use Maatwebsite\Excel\Concerns\WithMultipleSheets;
19-
use Maatwebsite\Excel\Concerns\WithCustomStartCell;
2018
use FromHome\ModelUpload\Jobs\ProcessModelRecordJob;
2119

22-
abstract class AbstractModelRecordImport implements ShouldQueue, SkipsUnknownSheets, WithBatchInserts, WithChunkReading, WithCustomStartCell, WithEvents, WithHeadingRow, WithMultipleSheets
20+
abstract class AbstractModelRecordImport implements ShouldQueue, SkipsUnknownSheets, WithBatchInserts, WithChunkReading, WithStartRow, WithEvents
2321
{
2422
use Importable;
2523

@@ -72,19 +70,10 @@ public function registerEvents(): array
7270
];
7371
}
7472

75-
public function sheets(): array
76-
{
77-
return [
78-
'DATA' => $this,
79-
];
80-
}
81-
82-
public function onUnknownSheet($sheetName): void
83-
{
84-
}
73+
public function onUnknownSheet($sheetName): void {}
8574

86-
public function startCell(): string
75+
public function startRow(): int
8776
{
88-
return ModelUpload::importStartCell();
77+
return ModelUpload::importStartRow();
8978
}
9079
}

src/ModelUpload.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@
1313

1414
final class ModelUpload
1515
{
16-
private static string $importStartCell = 'A1';
16+
private static int $importStartRow = 1;
1717

18-
public static function importStartCell(): string
18+
public static function importStartRow(): int
1919
{
20-
return self::$importStartCell;
20+
return self::$importStartRow;
2121
}
2222

23-
public static function useImportStartCell(string $importStartCell): void
23+
public static function useImportStartRow(int $importStartRow): void
2424
{
25-
self::$importStartCell = $importStartCell;
25+
self::$importStartRow = $importStartRow;
2626
}
2727

2828
/**
@@ -55,7 +55,10 @@ public static function storeModelUploadFile(Request $request, array $meta = [],
5555
$file = $request->file('file');
5656

5757
return $action->handle(
58-
$request->user(), $file, $modelType ?? $request->input('model_type'), $meta
58+
$request->user(),
59+
$file,
60+
$modelType ?? $request->input('model_type'),
61+
$meta
5962
);
6063
}
6164
}

0 commit comments

Comments
 (0)