2017 © Pedro Peláez
 

library laravel-forms

MWI Starter Forms extends Laravel Collective HTML

image

mwi/laravel-forms

MWI Starter Forms extends Laravel Collective HTML

  • Friday, April 13, 2018
  • by midwesternInteractive
  • Repository
  • 1 Watchers
  • 0 Stars
  • 163 Installations
  • HTML
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 17 % Grown

The README.md

MWI Laravel Forms

MWI Laravel froms is an extension of Laravel Collective Forms & HTML. It utilized components to build out bootsrap ready form inputs with parsley client side validation and select2 funcionality., (*1)

Installation

$ composer require mwi/laravel-forms

Service Provider

If you're on laravel 5.5 or later the service provider will be automatially loaded, if not, add to your config/app.php providers, (*2)

'providers' => [
    // ...
    MWI\LaravelForms\ServiceProvider::class,
    // ...
],

HTML Service Provider

You will also need to add the Laravel Collection provider if you haven't already, (*3)

'providers' => [
    // ...
    Collective\Html\HtmlServiceProvider::class,
    // ...
],

HTML Aliases

If you have't already you can add Laravel Collective HTML aliases, (*4)

'aliases' => [
    // ...
    'Form' => Collective\Html\FormFacade::class,
    'Html' => Collective\Html\HtmlFacade::class,
    // ...
],

Publish

Last but not least be sure to publish, (*5)

php artisan vendor:publish --provider="MWI\LaravelForms\ServiceProvider"

Usage

Here are the current tags available and how to best utilize them., (*6)

Text Field

Only the first parameter is required., (*7)

Variations available are mwitext, mwitextarea, mwidate, mwidaterange, mwiemail, mwipass and mwinumber., (*8)

Form::mwitext('field_name')
Form::mwitext('field_name_two', $default_value, ['class' => 'class-name'], 'Custom Label')

// No default value with attributes
Form::mwitext('name', null, ['class' => 'class-name'])

Radio Options

Form::mwiradio('Set Label', 'field_name', ['option_one', 'option_two'], 'option_one', ['class' => 'class-name'])

Select Field

Variations available are mwiselect and mwifilter., (*9)

Form::mwiselect('field_name', $options)
Form::mwiselect('field_name_two', ['this' => 'that', 'them' => 'they'], $default_value, ['class' => 'class-name'])

// No default value with attributes
Form::mwiselect('state', $options, null, ['class' => 'class-name'])

Structure

All tags are wrapped in a div.form-group and contain a label, input and error message container. It's recommended to additionally wrap elements in rows/grids as follows., (*10)

<div class="row">
    <div class="col-md-6">
        {{ Form::mwitext('field_name', $field_value, $attributes) }}
    </div>
    <div class="col-md-6">
        {{ Form::mwitext('field2_name', $field2_value, ['required', 'class' => 'text-red']) }}
    </div>
</div>

Additionaly the password field already contains col-6 grids, so..., (*11)

<div class="row">
    {{ Form::mwipass('password', ['required']) }}
</div>

Would produce..., (*12)

<div class="row">
    <div class="col-md-6">
        <div class="form-group">
            {{ Form::label('password', null, ['class' => 'control-label']) }}
            {{ Form::password('password', ['class' => 'form-control', 'id' => 'password', 'required']) }}
            <small class="help-block">{{ $errors->first('password') }}</small>
        </div>
    </div>
    <div class="col-md-6">
        <div class="form-group">
            {{ Form::label('password_confirmation', null, ['class' => 'control-label']) }}
            {{ Form::password('password_confirmation' . '_confirmation', ['class' => 'form-control']) }}
            <small class="help-block">{{ $errors->first('password_confirmation') }}</small>
        </div>
    </div>
</div>

The Versions

13/04 2018

dev-master

9999999-dev

MWI Starter Forms extends Laravel Collective HTML

  Sources   Download

MIT

The Requires

 

laravel forms

13/04 2018

v1.0.2

1.0.2.0

MWI Starter Forms extends Laravel Collective HTML

  Sources   Download

MIT

The Requires

 

laravel forms

14/02 2018

v1.0.1

1.0.1.0

MWI Starter Forms extends Laravel Collective HTML

  Sources   Download

MIT

The Requires

 

laravel forms

24/01 2018

v1.0.0

1.0.0.0

MWI Starter Forms extends Laravel Collective HTML

  Sources   Download

MIT

The Requires

 

laravel forms