mwi/laravel-forms 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mwi/laravel-forms

Composer 安装命令:

composer require mwi/laravel-forms

包简介

MWI Starter Forms extends Laravel Collective HTML

README 文档

README

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.

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

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

HTML Service Provider

You will also need to add the Laravel Collection provider if you haven't already

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

HTML Aliases

If you have't already you can add Laravel Collective HTML aliases

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

Publish

Last but not least be sure to publish

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

Usage

Here are the current tags available and how to best utilize them.

Text Field

Only the first parameter is required.

Variations available are mwitext, mwitextarea, mwidate, mwidaterange, mwiemail, mwipass and mwinumber.

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.

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.

<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...

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

Would produce...

<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>

统计信息

  • 总下载量: 12.61k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: Blade

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-12-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固