getAttribute('table')}.{$field}]" : ""; break; case "clientinfo_uid": case "serviceinfo_uid": case "serverinfo_uid": $rule = "permit_empty|numeric"; break; case "price": case "stock": $rule = "required|numeric"; break; case "status": $rule = "permit_empty|trim|string"; 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 $entity) { $tempOptions[$entity->getPK()] = $entity->getTitle(); // $options['attributes'][$entity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $entity->getRole())]; } $options['options'] = $tempOptions; break; case 'serverinfo_uid': foreach ($this->getFormOption_process(service('equipment_serverservice'), $action, $field, $entity) as $entity) { $tempOptions[$entity->getPK()] = $entity->getTitle(); // $options['attributes'][$entity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $entity->getRole())]; } $options['options'] = $tempOptions; break; default: $options = parent::getFormOption($action, $field, $entity, $options); break; } return $options; } }