Laravel Excel, mapped cells then proceed to rows after

Viewed 44

I want to import a csv file which has mapped cells in A1, A2 and B1 then proceeding with creating records which starts at row #3, problem is after having mapped cells, can't seem to escape it and doesn't access the row #3 after.

CSV File here

class TripTicketTmImport implements ToModel, WithStartRow, WithMappedCells
{
    use Importable, SkipsFailures;

    public $trip_ticket = null;

    /**
    * @param Collection $collection
    */
    public function mapping(): array
    {
        return [
            'start_date' => 'A1',
            'end_date' => 'B1',
            'emp_number' => 'A2'
        ];
    }

    public function startRow(): int
    {
        return 3;
    }

    public function model(array $row)
    {
        if(!isset($row['start_date'])){
            dd($row);
        }

It doesn't dd the $row so I assume it's not reading correctly.

Is there any way after getting the values of the mapped cell proceed to reading each row which starts at Row #3?

0 Answers
Related