<?php

namespace App\Imports;

use Maatwebsite\Excel\Concerns\ToModel;
use Maatwebsite\Excel\Concerns\WithHeadingRow;
use Maatwebsite\Excel\Concerns\ToCollection;

use Illuminate\Support\Collection;


class ExcelImport implements ToCollection
{
    /**
    * @param array $row
    *
    * @return \Illuminate\Database\Eloquent\Model|null
    */
     public function collection(Collection $collection)
    {
        $count=0;
        foreach ($collection as $row) 
        {
            
            $count++;
            if($count==1)
                continue; //for avoiding first row heading

            if(isset($row[3]))
            {
                $type = $row[3];
                $item_code = $row[0];
                $item_description = $row[2];
                $item_id = $row[8];
                ////get rows from excel////

                ///insert into table
            }           
        }
    }
}
