format('Y-m-d'); $endValidity = \Carbon\Carbon::createFromFormat('d/m/Y', trim($masaParts[1]))->format('Y-m-d'); } $batchData[] = [ 'tax_code' => trim($row['kode']) ?? '', 'tax_no' => trim($row['no']) ?? '', 'npwpd' => trim($row['npwpd']) ?? '', 'wp_name' => trim($row['nama_wp']) ?? '', 'business_name' => trim($row['nama_usaha']) ?? '', 'address' => trim($row['alamat_usaha']) ?? '', 'start_validity' => $startValidity, 'end_validity' => $endValidity, 'tax_value' => (float) str_replace(',', '', trim($row['nilai_pajak']) ?? '0'), 'subdistrict' => trim($row['kecamatan']) ?? '', 'village' => trim($row['desa']) ?? '', ]; if (count($batchData) >= $batchSize) { Tax::upsert($batchData, ['tax_no'], ['tax_code', 'tax_no', 'npwpd', 'wp_name', 'business_name', 'address', 'start_validity', 'end_validity', 'tax_value', 'subdistrict', 'village']); $batchData = []; } } if (!empty($batchData)) { Tax::upsert($batchData, ['tax_no'], ['tax_code', 'tax_no', 'npwpd', 'wp_name', 'business_name', 'address', 'start_validity', 'end_validity', 'tax_value', 'subdistrict', 'village']); } } public function sheets(): array { return [ 0 => $this ]; } public function chunkSize(): int { return 1000; } public function batchSize(): int { return 1000; } }