rackbeat / laravel-validate-mysql-integers
验证规则,确保值在有效的MySQL整数范围内。
2.0
2022-11-26 08:33 UTC
Requires
- php: >=7.1
- ext-bcmath: *
- illuminate/contracts: ^5.6|^6.0|^7.0|^8.0|^9.0
- illuminate/support: ^5.6|^6.0|^7.0|^8.0|^9.0
- illuminate/validation: ^5.6|^6.0|^7.0|^8.0|^9.0
Requires (Dev)
- phpunit/phpunit: ^7.0
- satooshi/php-coveralls: ^1.0
README
适用于以下类型的带符号和无符号整数:TinyInt, SmallInt, Int, BigInt。
安装
只需使用composer,您就可以开始了!
composer require rackbeat/laravel-validate-mysql-integers
服务提供者会自动注册。
使用方法
类
Rackbeat\Rules\TinyInteger
Rackbeat\Rules\SmallInteger
Rackbeat\Rules\Integer
Rackbeat\Rules\BigInteger
'number' => [ new Rackbeat\Rules\BigInteger($unsigned = true), ],
辅助函数
辅助函数以 "real_" 为前缀,以防止冲突。它可以接受一个可选参数以确定是否为无符号。默认为 false
。
real_tiny_int
real_small_int
real_int
real_big_int
'id' => ['real_tiny_int:1'], // unsigned 'number' => ['real_tiny_int:0'], // signed
要求
- PHP >= 7.1