logService = new OperationLogService(); $this->logService->menuTitle = 'cat_attr'; $this->parkingSpaceType = $parking_space_type; } /** * @param array $row */ public function model(array $row) { if ($this->index == 1) { $this->index += 1; return; } $this->index += 1; $number = $row[1] ?? ''; if (empty($number)) { $this->error[] = imports_error($this->index, 'import33'); return; } $where = [ 'number' => $number, 'space_type_id' => $this->parkingSpaceType ]; if (ParkingLicensePlate::query()->where($where) ->exists() ) { $this->error[] = imports_error($this->index, 'import37'); return; } $model = ParkingLicensePlate::query()->create([ 'number' => $number, 'space_type_id' => $this->parkingSpaceType, 'created_at' => get_datetime() ]); $this->logService->logCreated($model, 'license_plate.create'); } public function errorArr(): array { return $this->error; } }