model_name = $model_name; $this->en_name = $en_name ?? ''; $this->tw_name = $tw_name ?? ''; $this->user_id = $user_id; } /** * @param array $row */ public function model(array $row) { if (!$this->index) { $this->index += 1; return; } $this->index += 1; if (empty($row[1]) && empty($row[2])) { return; } if (empty($row[1])) { $this->error[] = imports_error($this->index, 'import15'); return; } if (empty($row[2])) { $this->error[] = imports_error($this->index, 'import16'); return; } $data = [ 'model_name' => $this->model_name, 'admin_user_id' => $this->user_id, 'parking_space_number' => $row[1], 'parking_space_type' => $row[2], 'en_name' => $this->en_name, 'tw_name' => $this->tw_name ]; $service = new ParkingPatternService(new OperationLogService()); $error_str = $service->saveModel($data); if ($error_str) { $this->error[] = imports_error($this->index, $error_str); } } public function errorArr(): array { return $this->error; } }