russoedu/colorvalidator
最新稳定版本:1.0
Composer 安装命令:
composer require russoedu/colorvalidator
包简介
Custom Laravel 5 Validator for hexadecimal color
README 文档
README
Validator for hexadecimal colors for Laravel 5.
![Software License][ico-license]
Installation
Install the package through Composer.
composer require "russoedu/colorvalidator:1.0"
Add the following to your providers array in app/config/app.php:
'providers' = [ Russoedu\ColorValidator\ColorValidatorServiceProvider::class, ]
Usage
The package extends the Illuminate\Validator via a service provider, so all you have to do is use the hex_color-rule.
public function store(Request $request) { $this->validate($request, [ 'color' => 'hex_color' ]); }
Of course, you can roll your own error messages:
$validator = Validator::make($request->all(), [ 'color' => 'hex_color' ], [ 'color.hex_color' => "Hey! That's not real color!" ]); if($validator->fails()) { return $this->returnWithErrorAndInput($validator); }
If you're using the validation throughout your application, you also might want to put the error message in your lang-files.
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 55
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-09-10