12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <?php
-
- namespace App\Imports;
-
- use App\Model\Data\StockRelease;
- use Maatwebsite\Excel\Concerns\ToModel;
- // use Illuminate\Support\Collection;
- // use Maatwebsite\Excel\Concerns\ToCollection;
- use Maatwebsite\Excel\Concerns\WithHeadingRow;
- use Maatwebsite\Excel\Concerns\WithStartRow;
- // use Maatwebsite\Excel\Concerns\WithBatchInserts;
- // use Maatwebsite\Excel\Concerns\WithChunkReading;
- use App\Helpers\Helper;
- use Auth;
-
-
- class StockReleaseImport implements ToModel, WithHeadingRow, WithStartRow
- // class StockReleaseImport implements ToCollection, WithHeadingRow
- {
- private $route = 'admin.data.stock_darah.';
- /**
- * @param array $row
- *
- * @return \Illuminate\Database\Eloquent\Model|null
- */
- public function headingRow(): int
- {
- return 17;
- }
-
- public function startRow(): int
- {
- return 18;
- }
-
- public function model(Array $row)
- {
- // foreach ($rows as $row)
- // {
- return new StockRelease([
- 'no_release' => $row['no_release'],
- 'no_kantong' => $row['no_kantong'],
- 'produk_id' => $row['produk_id'],
- 'golongan_darah_id' => $row['golongan_darah_id'],
- 'status_keterangan' => $row['status_keterangan'],
- 'user_checker_id' => Auth::user()->id,
- 'user_pengesah_id' => Auth::user()->id,
- 'is_delivery' => $row['is_delivery'],
- 'tanggal_release' => $row['tanggal_release'],
- 'tanggal_aftap' => $row['tanggal_aftap'],
- 'volume_release' => $row['volume_release'],
- 'rhesus_id' => $row['rhesus_id'],
- 'unit_donor_darah_id' => $row['unit_donor_darah_id'],
- 'expired_date' => $row['expired_date'],
- 'status_id' => $row['status_id'],
- 'tanggal_olah' => $row['tanggal_olah'],
- ]);
-
- }
-
- // public function batchSize(): int
- // {
- // return 1000;
- // }
-
- // public function chunkSize(): int
- // {
- // return 1000;
- // }
- }
|