public function field($field, $prefix = null)
    {
        if (is_array($field)) {
            $field = new Field($field);
        }

        if (! $field instanceof FieldInterface) {
            throw new Exception('Field must implement interface '.FieldInterface::class.' or be an array.');
        }

        $formField = $this->getRegistrar()->resolve($field);

        if ($prefix) {
            $formField->setPrefix($prefix);
        }

        return $formField;
    }
public function field($field, $prefix = null)
    {
        if (is_array($field)) {
            $field = new Field($field);
        }

        if (! $field instanceof FieldInterface) {
            throw new Exception('Field must implement interface '.FieldInterface::class.' or be an array.');
        }

        $formField = $this->getRegistrar()->resolve($field);

        if ($prefix) {
            $formField->setPrefix($prefix);
        }

        return $formField;
    }
public function field ( $ field , $ prefix = null ) { if ( is_array ( $ field ) ) { $ field = new Field ( $ field ) ; } if ( ! $ field instanceof FieldInterface ) { throw new Exception ( 'Field must implement interface ' . FieldInterface :: class . ' or be an array.' ) ; } $ formField = $ this -> getRegistrar ( ) -> resolve ( $ field ) ; if ( $ prefix ) { $ formField -> setPrefix ( $ prefix ) ; } return $ formField ; }
Instantiates a new FormField from our Field model or array.

@param      $field

@param null $prefix

@return mixed
@throws Exception
Instantiates a new FormField from our Field model or array .