/** * @param $name * @param null $container * * @return ElementTbText */ function add($name, $container = null) { $method = \Str::studly('add_' . $name); if (!$container) { $container = $this->form; } $element = call_user_func([$this, $method], $container); /* @var ElementTbText $element */ $element->toggleFrozen(!$this->isFieldEnabled($name)); if (!$element->getLabel()) { $element->setLabel($this->model->getEntityLabel($name)); } return $element; }
function toArray() { $ret = []; foreach ($this->model->toArray() as $k => $v) { $ret[$k] = $this->get($k); } return $ret; }