Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 5 additions & 16 deletions src/AbstractModelRecordImport.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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();
}
}
15 changes: 9 additions & 6 deletions src/ModelUpload.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down Expand Up @@ -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
);
}
}