定制 solbeg/laravel-vue-validation 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

solbeg/laravel-vue-validation

Composer 安装命令:

composer require solbeg/laravel-vue-validation

包简介

Extends Bootstrapper package. It automatically converts Laravel's request rules into Vee's rules.

README 文档

README

PACKAGE IS NOT MAINTAINED, USE AT YOUR OWN RISK

SolbegLaravelVueValidation

It is plugin for Laravel applications that use Vee-Validate plugin for front validation.

It automatically converts laravel's FormRequest rules to Vee rules. It also passes errors messages to Vee validator.

So you may write your rules once in laravel application, so the same will be used in front side too.

Requirements

Installation

Install plugin using composer:

$ php composer.phar require solbeg/laravel-vue-validation

After you have installed this vendor, add the following lines.

In your Laravel config file config/app.php in the providers array add the service provider for this package.

    // ...
    Solbeg\VueValidation\ServiceProvider::class,
    // ...

And add the facade of this package to the aliases array.

    // ...
    'F' => Solbeg\VueValidation\Facades\Form::class,
    'HTML' => Solbeg\VueValidation\Facades\Html::class,
    // ...

Publish assets for this vendor:

$  php artisan vendor:publish --force --provider="Solbeg\VueValidation\ServiceProvider" --tag=public

Connect JS file for this plugin in your layout. Note! This JS file must be included after Vue & Vee JS files:

<script src="{{ asset('vendor/solbeg/laravel-vue-validation/init-vue-validation.js') }}"></script>

Add the following JS code in your layout, so the Vue will use this plugin for validating:

Vue.use(SolbegLaravelVueValidation);

Usage

In your blade template:

{{ F::open([
    // ...
    'request' => \App\Http\Requests\YourFormRequestClass::class,
]) }}

    ...

    {!! F::controlGroup('phone',
        F::label('phone', 'Phone number'),
        F::text('phone', old('phone', $user->phone))
    ) !!}


    ...

{{ F::close([
    /**
     * Additional params for Vue object.
     * They will be passed in `new Vue({here})` constructor
     */
    'data' => [
        'prop1' => 'val1',
    ],
]) }}

{{-- OR without additional Vue options --}}
{{ F::close() }}
{{ F::close(true) }}

{{-- OR `false` if you initialize Vue object by himself --}}
{{ F::close(false) }}

统计信息

  • 总下载量: 249
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 6
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 6
  • Watchers: 3
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2016-10-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固