getAttribute('table')}.{$field}]" : ""; break; case "ip": $rule = "permit_empty|trim|valid_ip[both]"; //ipv4 , ipv6 , both(ipv4,ipv6) $rule .= in_array($action, ["create", "create_form"]) ? "|is_unique[{$this->getAttribute('table')}.{$field}]" : ""; break; case "os": $rule = "permit_empty|trim|string"; break; case "format_at": $rule = "permit_empty|valid_date"; break; default: $rule = parent::getFormRule($action, $field); break; } return $rule; } public function getFormOption(string $action, string $field, ?object $entity = null, array $options = ['options' => [], 'extras' => [], 'atttributes' => []]): array { $tempOptions = ['' => lang("{$this->getAttribute('class_path')}.label.{$field}") . " 선택"]; switch ($field) { case 'serviceinfo_uid': foreach ($this->getFormOption_process(service('customer_serviceservice'), $action, $field, $entity) as $tempEntity) { $tempOptions[$tempEntity->getPK()] = $tempEntity->getTitle(); // $options['attributes'][$tempEntity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $tempEntity->getRole())]; } $options['options'] = $tempOptions; break; case 'switch': foreach ($this->getFormOption_process(service('part_switchservice'), $action, $field, $entity) as $tempEntity) { $tempOptions[$tempEntity->getTitle()] = $tempEntity->getTitle(); // $options['attributes'][$tempEntity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $tempEntity->getRole())]; } $options['options'] = $tempOptions; // dd($options); break; case 'ip': foreach ($this->getFormOption_process(service('part_ipservice'), $action, $field, $entity) as $tempEntity) { $tempOptions[$tempEntity->getTitle()] = $tempEntity->getTitle(); // $options['attributes'][$tempEntity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $tempEntity->getRole())]; } $options['options'] = $tempOptions; break; default: $options = parent::getFormOption($action, $field, $entity, $options); break; } return $options; } }