79 lines
2.9 KiB
PHP
79 lines
2.9 KiB
PHP
<?php
|
|
|
|
namespace App\Imports;
|
|
|
|
use App\Models\Dataset\DatasetTable22;
|
|
use Maatwebsite\Excel\Concerns\ToModel;
|
|
use Maatwebsite\Excel\Concerns\WithStartRow;
|
|
|
|
class DatasetTable22Import implements ToModel,WithStartRow
|
|
{
|
|
/**
|
|
* @param array $row
|
|
*
|
|
* @return \Illuminate\Database\Eloquent\Model|null
|
|
*/
|
|
protected $datasetId;
|
|
protected $userId;
|
|
|
|
public function __construct($datasetId,$userId)
|
|
{
|
|
$this->datasetId = $datasetId;
|
|
$this->userId = $userId;
|
|
}
|
|
|
|
public function startRow(): int
|
|
{
|
|
return 6;
|
|
}
|
|
|
|
public function model(array $row)
|
|
{
|
|
return new DatasetTable22([
|
|
'dataset_id' => $this->datasetId,
|
|
'created_by' => $this->userId,
|
|
'lokasi' => $row[0],
|
|
'waktu' => $row[1],
|
|
'lat' => $row[2],
|
|
'long' => $row[3],
|
|
'tempratur' => $row[4],
|
|
'ph' => $row[5],
|
|
'kekeruhan' => $row[6],
|
|
'warna' => $row[7],
|
|
'rasa' => $row[8],
|
|
'bau' => $row[9],
|
|
'tds' => $row[10],
|
|
'bod' => $row[11],
|
|
'cod' => $row[12],
|
|
'do' => $row[13],
|
|
'fosfat' => $row[14],
|
|
'no3' => $row[15],
|
|
'nh3' => $row[16],
|
|
'arsen' => $row[17],
|
|
'kobalt' => $row[18],
|
|
'barium' => $row[19],
|
|
'boron' => $row[20],
|
|
'selenium' => $row[21],
|
|
'kadmium' => $row[22],
|
|
'khrom' => $row[23],
|
|
'tembaga' => $row[24],
|
|
'besi' => $row[25],
|
|
'timbal' => $row[26],
|
|
'mangan' => $row[27],
|
|
'air_raksa' => $row[28],
|
|
'seng' => $row[29],
|
|
'khlorida' => $row[30],
|
|
'sianida' => $row[31],
|
|
'fluorida' => $row[32],
|
|
'nitrit' => $row[33],
|
|
'sulfat' => $row[34],
|
|
'khlorin_bebas' => $row[35],
|
|
'belereng' => $row[36],
|
|
'fecal_coliform' => $row[37],
|
|
'total_coliform' => $row[38],
|
|
'gross' => $row[39],
|
|
'grossb' => $row[40],
|
|
]);
|
|
}
|
|
}
|