field가 array 입니다.\n" . var_export($field, true)); } switch ($field) { case "clientinfo_uid": case "ownerinfo_uid": $rule = "required|numeric"; break; case "type": case "location": case "switch": case "code": case "status": $rule = "required|trim|string"; break; case "billing_at": case "start_at": $rule = "required|valid_date"; break; case "raid": $rule = "if_exist|trim|string"; break; default: $rule = parent::getFormFieldRule($action, $field); break; } return $rule; } //다음 달로 결제일을 연장합니다. public function extendPaymentDate(int $uid): mixed { $sql = "UPDATE ? SET billing_at = IF( DAY(billing_at) = DAY(LAST_DAY(billing_at)), LAST_DAY(DATE_ADD(billing_at, INTERVAL 1 MONTH)), DATE_ADD(billing_at, INTERVAL 1 MONTH)) WHERE uid = ? AND status = ?"; $sql = $this->setQuery($sql) ->setParameter(1, $this->getTableName()) ->setParameter(2, $uid) ->setParameter(3, DEFAULTS['STATUS']) ->getSQL(); if (!$sql) { throw new \Exception("SQL문이 생성되지 않았습니다."); } if (!$this->isValidQuery($sql)) { throw new \Exception("SQL문이 유효하지 않습니다: " . $sql); } // 쿼리 실행 if (!$this->execute($sql)) { throw new \Exception("SQL문 실행에 실패했습니다: " . $sql); } return $this->query($sql); } }