public function text($name, $options = [])
    {
        $requiredClass = (isset($options['required']) && $options['required'] == true) ? 'required ' : '';
        $hasError = $this->errorBag->has($this->formatArrayName($name));
        $hasErrorClass = $hasError ? 'has-error' : '';
        $htmlForm = '<div class="form-group '.$requiredClass.$hasErrorClass.'">';

        $htmlForm .= $this->setFormFieldLabel($name, $options);

        if (isset($options['addon'])) {
            $htmlForm .= '<div class="input-group">';
        }
        if (isset($options['addon']['before'])) {
            $htmlForm .= '<span class="input-group-prepend"><div class="input-group-text">'.$options['addon']['before'].'</div></span>';
        }

        $type = isset($options['type']) ? $options['type'] : 'text';
        $value = isset($options['value']) ? $options['value'] : null;
        $fieldAttributes = $this->getFieldAttributes($options);

        if (isset($options['placeholder'])) {
            $fieldAttributes += ['placeholder' => $options['placeholder']];
        }

        if ($hasError) {
            $fieldAttributes['class'] .= ' is-invalid';
        }

        $htmlForm .= FormFacade::input($type, $name, $value, $fieldAttributes);

        if (isset($options['addon']['after'])) {
            $htmlForm .= '<span class="input-group-append"><div class="input-group-text">'.$options['addon']['after'].'</div></span>';
        }
        if (isset($options['addon'])) {
            $htmlForm .= '</div>';
        }

        $htmlForm .= $this->getInfoTextLine($options);

        $htmlForm .= $this->errorBag->first($this->formatArrayName($name), '<span class="invalid-feedback" role="alert">:message</span>');

        $htmlForm .= '</div>';

        return $htmlForm;
    }
public function text($name, $options = [])
    {
        $requiredClass = (isset($options['required']) && $options['required'] == true) ? 'required ' : '';
        $hasError = $this->errorBag->has($this->formatArrayName($name));
        $hasErrorClass = $hasError ? 'has-error' : '';
        $htmlForm = '<div class="form-group '.$requiredClass.$hasErrorClass.'">';

        $htmlForm .= $this->setFormFieldLabel($name, $options);

        if (isset($options['addon'])) {
            $htmlForm .= '<div class="input-group">';
        }
        if (isset($options['addon']['before'])) {
            $htmlForm .= '<span class="input-group-prepend"><div class="input-group-text">'.$options['addon']['before'].'</div></span>';
        }

        $type = isset($options['type']) ? $options['type'] : 'text';
        $value = isset($options['value']) ? $options['value'] : null;
        $fieldAttributes = $this->getFieldAttributes($options);

        if (isset($options['placeholder'])) {
            $fieldAttributes += ['placeholder' => $options['placeholder']];
        }

        if ($hasError) {
            $fieldAttributes['class'] .= ' is-invalid';
        }

        $htmlForm .= FormFacade::input($type, $name, $value, $fieldAttributes);

        if (isset($options['addon']['after'])) {
            $htmlForm .= '<span class="input-group-append"><div class="input-group-text">'.$options['addon']['after'].'</div></span>';
        }
        if (isset($options['addon'])) {
            $htmlForm .= '</div>';
        }

        $htmlForm .= $this->getInfoTextLine($options);

        $htmlForm .= $this->errorBag->first($this->formatArrayName($name), '<span class="invalid-feedback" role="alert">:message</span>');

        $htmlForm .= '</div>';

        return $htmlForm;
    }
public function text ( $ name , $ options = [ ] ) { $ requiredClass = ( isset ( $ options [ 'required' ] ) && $ options [ 'required' ] == true ) ? 'required ' : '' ; $ hasError = $ this -> errorBag -> has ( $ this -> formatArrayName ( $ name ) ) ; $ hasErrorClass = $ hasError ? 'has-error' : '' ; $ htmlForm = '<div class="form-group ' . $ requiredClass . $ hasErrorClass . '">' ; $ htmlForm .= $ this -> setFormFieldLabel ( $ name , $ options ) ; if ( isset ( $ options [ 'addon' ] ) ) { $ htmlForm .= '<div class="input-group">' ; } if ( isset ( $ options [ 'addon' ] [ 'before' ] ) ) { $ htmlForm .= '<span class="input-group-prepend"><div class="input-group-text">' . $ options [ 'addon' ] [ 'before' ] . '</div></span>' ; } $ type = isset ( $ options [ 'type' ] ) ? $ options [ 'type' ] : 'text' ; $ value = isset ( $ options [ 'value' ] ) ? $ options [ 'value' ] : null ; $ fieldAttributes = $ this -> getFieldAttributes ( $ options ) ; if ( isset ( $ options [ 'placeholder' ] ) ) { $ fieldAttributes += [ 'placeholder' => $ options [ 'placeholder' ] ] ; } if ( $ hasError ) { $ fieldAttributes [ 'class' ] .= ' is-invalid' ; } $ htmlForm .= FormFacade :: input ( $ type , $ name , $ value , $ fieldAttributes ) ; if ( isset ( $ options [ 'addon' ] [ 'after' ] ) ) { $ htmlForm .= '<span class="input-group-append"><div class="input-group-text">' . $ options [ 'addon' ] [ 'after' ] . '</div></span>' ; } if ( isset ( $ options [ 'addon' ] ) ) { $ htmlForm .= '</div>' ; } $ htmlForm .= $ this -> getInfoTextLine ( $ options ) ; $ htmlForm .= $ this -> errorBag -> first ( $ this -> formatArrayName ( $ name ) , '<span class="invalid-feedback" role="alert">:message</span>' ) ; $ htmlForm .= '</div>' ; return $ htmlForm ; }
Text input field that wrapped with form-group bootstrap div.

@param  string  $name  The text field name and id attribute.
@param  array  $options  Additional attribute for the text input.
@return string  Generated text input form field.
Text input field that wrapped with form - group bootstrap div .