承接 ahkmunna/validator 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

ahkmunna/validator

Composer 安装命令:

composer require ahkmunna/validator

包简介

Laravel 5 composite unique validator

README 文档

README

A muti-column unique validation extension with exception for Laravel 5.*

Installation

Install the package through Composer.

On you project directory run the composer require command from the Terminal:

composer require ahkmunna/validator

Now add the service provider to your config/app.php file. Add this line to the providers array:

ahkmunna\validator\validatorServiceProvider::class

##Translations Run this command to move the translation file

php artisan vendor:publish

##Error messages Add this method in your validation request class

public function messages()
{
    return [
        'email.composite_unique' => trans('validator::validation.composite_unique'),
    ];
}

Now you're ready to start using the validator in your application.

###Use case 1 Like any laravel validation rules:

$rules = array(
    'field_name' => 'composite_unique:table, unique_column_1, unique_column_2, unique_column_3',
);

###Use case 2 Pass a value or Check uniqueness with a field that not in current form request:

$rules = array(
    'field_name' => 'composite_unique:table, unique_column_1, unique_column_2:4, unique_column_3',
);

unique_column_2 is passed with a value so the validator will ignore the form request value and compare the field with the given value, It is useful sometimes, you can give a field name that not exist in the form request but in the database table.

###Use case 3 Check uniqueness with exception:

$rules = array(
    'field_name' => 'composite_unique:table, unique_column_1, unique_column_2, unique_column_3, 1',
);

The last parameter is a primary key of the table that row will be ignored. Useful for update operation.

##+++ Thank You +++

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-01-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固