12345678910111213141516171819202122232425262728293031323334 |
- <?php
- namespace App\Imports\Vaccines;
- use App\Models\Vaccines;
- use Maatwebsite\Excel\Concerns\ToModel;
- use Maatwebsite\Excel\Concerns\WithStartRow;
- use Maatwebsite\Excel\Facades\Excel;
- class ImportMember implements ToModel
- {
- /**
- * @param array $row
- *
- * @return \Illuminate\Database\Eloquent\Model|null
- */
- public function model(array $row)
- {
- return new Vaccines([
- //
- 'type' => $row[1],
- 'name' => $row[2],
- 'introduction' => $row[3],
- 'price' => $row[4],
- 'remark' => $row[5],
- 'supplier' => $row[6],
- 'states' => $row[7]
- ]);
- }
- public function startRow(): int
- {
- return 2;
- }
- }
|