Keine Beschreibung
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

StockReleaseImport.php 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. namespace App\Imports;
  3. use App\Model\Data\StockRelease;
  4. use Maatwebsite\Excel\Concerns\ToModel;
  5. // use Illuminate\Support\Collection;
  6. // use Maatwebsite\Excel\Concerns\ToCollection;
  7. use Maatwebsite\Excel\Concerns\WithHeadingRow;
  8. use Maatwebsite\Excel\Concerns\WithStartRow;
  9. // use Maatwebsite\Excel\Concerns\WithBatchInserts;
  10. // use Maatwebsite\Excel\Concerns\WithChunkReading;
  11. use App\Helpers\Helper;
  12. use Auth;
  13. class StockReleaseImport implements ToModel, WithHeadingRow, WithStartRow
  14. // class StockReleaseImport implements ToCollection, WithHeadingRow
  15. {
  16. private $route = 'admin.data.stock_darah.';
  17. /**
  18. * @param array $row
  19. *
  20. * @return \Illuminate\Database\Eloquent\Model|null
  21. */
  22. public function headingRow(): int
  23. {
  24. return 17;
  25. }
  26. public function startRow(): int
  27. {
  28. return 18;
  29. }
  30. public function model(Array $row)
  31. {
  32. // foreach ($rows as $row)
  33. // {
  34. return new StockRelease([
  35. 'no_release' => $row['no_release'],
  36. 'no_kantong' => $row['no_kantong'],
  37. 'produk_id' => $row['produk_id'],
  38. 'golongan_darah_id' => $row['golongan_darah_id'],
  39. 'status_keterangan' => $row['status_keterangan'],
  40. 'user_checker_id' => Auth::user()->id,
  41. 'user_pengesah_id' => Auth::user()->id,
  42. 'is_delivery' => $row['is_delivery'],
  43. 'tanggal_release' => $row['tanggal_release'],
  44. 'tanggal_aftap' => $row['tanggal_aftap'],
  45. 'volume_release' => $row['volume_release'],
  46. 'rhesus_id' => $row['rhesus_id'],
  47. 'unit_donor_darah_id' => $row['unit_donor_darah_id'],
  48. 'expired_date' => $row['expired_date'],
  49. 'status_id' => $row['status_id'],
  50. 'tanggal_olah' => $row['tanggal_olah'],
  51. ]);
  52. }
  53. // public function batchSize(): int
  54. // {
  55. // return 1000;
  56. // }
  57. // public function chunkSize(): int
  58. // {
  59. // return 1000;
  60. // }
  61. }