Exemplo n.º 1
0
 /**
  * @param \inkvizytor\FluentForm\Base\Field $control
  */
 public function control(Field $control)
 {
     $this->name($control->getName());
     $this->help($control->getHelp());
     $this->label($control->getLabel(), $this->isSrOnly());
     $this->required($control->isRequired());
     $this->setAttr($control->getAttr(null));
     $this->setData($control->getData(null));
     $this->css($control->getCss());
     $width = $control->getWidth();
     $this->width(array_get($width, 'lg'), array_get($width, 'md'), array_get($width, 'sm'), array_get($width, 'xs'));
     $this->control = $control;
 }
Exemplo n.º 2
0
 /**
  * @param \inkvizytor\FluentForm\Base\Field $control
  * @return bool
  */
 public function isRequired(Field $control)
 {
     $rules = array_get($this->rules, $control->getName(), []);
     return $control->isRequired() || (is_array($rules) ? array_has($rules, 'required') : str_contains($rules, 'required'));
 }