effectdigital / laravel-number-validation
添加了比较整数和浮点数值的验证规则
v1.0
2016-08-26 17:15 UTC
Requires
- illuminate/support: ^5.1
This package is auto-updated.
Last update: 2024-09-11 15:54:24 UTC
README
要开始使用,请通过Composer安装该包;
composer require effectdigital/laravel-number-validation
现在在您的config/app.php
文件中注册服务提供者
EffectDigital\LaravelNumberValidation\ValidatorServiceProvider::class,
最后,通过向resources/lang/en/validation.php
文件中添加以下行来为新规则创建验证消息
'gte' => 'The :attribute must be greater-than or equal to :other',
'gt' => 'The :attribute must be greater-than :other',
'lte' => 'The :attribute must be less-than or equal to :other',
'lt' => 'The :attribute must be less-than :other',
示例用法
[
'range_start' => 'required|integer',
'range_end' => 'required|integer|gte:range_start',
]
// OR
[
'days' => 'required|integer|lte:7',
]