<?php

namespace App\Imports;

 
use Illuminate\Support\Collection;
use Maatwebsite\Excel\Concerns\ToCollection;
use Session;
 
use Maatwebsite\Excel\Concerns\WithHeadingRow;
class ExcelImport  implements   ToCollection  , WithHeadingRow
{
   
   public function collection(Collection $rows)
    {
		#Session::put('xcel_ip_file',$rows);
		 //return $rows;
	 	#$array = array();
       // foreach ($rows as $row) {
          // dd($row);
       // }
	   return $rows ;#ถ้าไม่เป็น object
		return json_decode(json_encode($rows), FALSE) ;
    }
	
/*	public function sheets(): array
    {
        return [
            'Worksheet 1' => new FirstSheetImport(),
            'Worksheet 2' => new SecondSheetImport(),
        ];
    }
	*/
	
	
	
  
}
/*
class FirstSheetImport implements SkipsUnknownSheets
{
    public function onUnknownSheet($sheetName)
    {
		
        // E.g. you can log that a sheet was not found.
        info("Sheet {$sheetName} was skipped");
    }
}
class SecondSheetImport implements SkipsUnknownSheets
{
    public function onUnknownSheet($sheetName)
    {
        // E.g. you can log that a sheet was not found.
        info("Sheet {$sheetName} was skipped");
    }
}*/