file() public method

Create a file input field.
public file ( string $name, array $options = [] ) : Illuminate\Support\HtmlString
$name string
$options array
return Illuminate\Support\HtmlString
Exemplo n.º 1
0
 public function file($name, $options = [])
 {
     $options = $this->setOptionClasses($name, $options, ['form-control form-control-file']);
     $controlOptions = $this->getControlOptions(collect($options), ['placeholder']);
     $controlHtml = parent::file($name, $controlOptions->toArray());
     return $this->renderControl('file', $controlHtml, $name, '', $options);
 }
Exemplo n.º 2
0
 /**
  * Create a file input field.
  *
  * @param string $name
  * @param array $options
  * @return string 
  * @static 
  */
 public static function file($name, $options = array())
 {
     return \Collective\Html\FormBuilder::file($name, $options);
 }
Exemplo n.º 3
0
    $element = Form::password($name, field_attributes($name, $attributes));
    return form_group($element, $name);
});
Form::macro('textareaField', function ($name, $label = NULL, $value = NULL, $attributes = []) {
    $attributes = array_merge($attributes, ['rows' => 4]);
    $element = Form::textarea($name, $value ? $value : old($name), field_attributes($name, $attributes));
    return field_wrapper($name, $label, $element);
});
Form::macro('tinymce', function ($name, $label = NULL, $value = NULL, $attributes = []) {
    $attributes = array_merge($attributes, ['rows' => 4, 'data-tinymce' => 'true']);
    $element = Form::textarea($name, $value ? $value : old($name), field_attributes($name, $attributes));
    $element .= Form::hidden($name . '_text', $value ? $value : old($name), ['id' => $name . '_text']);
    return field_wrapper($name, $label, $element);
});
Form::macro('fileField', function ($name, $label = NULL, $attributes = []) {
    $element = '<p>' . Form::file($name, field_attributes($name, $attributes, true)) . '</p>';
    return field_wrapper($name, $label, $element);
});
Form::macro('textareaFieldClean', function ($name, $label = NULL, $value = NULL, $attributes = []) {
    $attributes = array_merge($attributes, ['placeholder' => $label, 'rows' => 4]);
    $element = Form::textarea($name, $value ? $value : old($name), field_attributes($name, $attributes));
    return form_group($element, $name);
});
Form::macro('selectFieldClean', function ($name, $label = NULL, $options, $value = NULL, $attributes = []) {
    $attributes = array_merge($attributes, ['placeholder' => $label]);
    $element = Form::select($name, $options, $value ? $value : old($name), field_attributes($name, $attributes));
    return form_group($element, $name);
});
Form::macro('selectizeClean', function ($name, $label = NULL, $options, $attributes = [], $value = NULL) {
    $attributes = array_merge($attributes, ['data-selectize' => 'true', 'placeholder' => $label]);
    $element = Form::select($name, $options, $value ? $value : old($name), field_attributes($name, $attributes));