70 lines
1.8 KiB
PHP
70 lines
1.8 KiB
PHP
<?php
|
|
namespace App\Imports;
|
|
use App\Models\DataUploadBosOmspan;
|
|
use Maatwebsite\Excel\Concerns\ToModel;
|
|
use Maatwebsite\Excel\Concerns\Importable;
|
|
use Maatwebsite\Excel\Concerns\WithStartRow;
|
|
use Maatwebsite\Excel\Concerns\WithSkipDuplicates;
|
|
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
|
|
use Illuminate\Support\Facades\Auth;
|
|
|
|
class ImportDataBos implements WithColumnFormatting, ToModel, WithStartRow
|
|
{
|
|
use Importable;
|
|
protected $ta;
|
|
|
|
public function __construct($ta){
|
|
$this->ta = $ta;
|
|
}
|
|
|
|
public function startRow(): int
|
|
{
|
|
return 2;
|
|
}
|
|
|
|
public function model(array $row)
|
|
{
|
|
// if (!isset($row[0])) {
|
|
// return null;
|
|
// }
|
|
var_dump($row); exit;
|
|
$data = [
|
|
"no"=>$row[0],
|
|
"kanwil"=>$row[1],
|
|
"kppn"=>$row[2],
|
|
"lokasi_kewenangan"=>$row[3],
|
|
"lokasi_sekolah"=>$row[4],
|
|
"no_tgl_sk"=>$row[5],
|
|
"jenis_bos"=>$row[6],
|
|
"tahap"=>$row[7],
|
|
"gelombang"=>$row[8],
|
|
"npsn_nama_sekolah"=>$row[9],
|
|
"jenis_satuan_pendidikan"=>$row[10],
|
|
"status_sekolah"=>$row[11],
|
|
"bank"=>$row[12],
|
|
"no_rekening_nama_rekening"=>$row[13],
|
|
"npsn"=>$row[14],
|
|
"rekening"=>$row[15],
|
|
"nama"=>$row[16],
|
|
"jenjang_sekolah"=>$row[17],
|
|
"no_tgl_sp2d_detail"=>$row[18],
|
|
"no_sp2d"=>$row[19],
|
|
"tgl_sp2d"=>$row[20],
|
|
"status"=>$row[21],
|
|
"nilai"=>$row[22],
|
|
"pagu"=>$row[23],
|
|
"jmlh_siswa"=>$row[24],
|
|
"ket_retur"=>$row[25]
|
|
];
|
|
|
|
return new DataUploadBosOmspan($data);
|
|
}
|
|
|
|
public function columnFormats(): array
|
|
{
|
|
return [
|
|
'Tgl' => NumberFormat::FORMAT_DATE_DDMMYYYY,
|
|
];
|
|
}
|
|
}
|