rackbeat / laravel-validate-mysql-integers
Validation Rule to ensure a value is within valid Mysql Integer ranges.
Installs: 28 033
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 2
Forks: 4
Open Issues: 0
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
Works for signed and unsigned integers of type: TinyInt, SmallInt, Int, BigInt.
Installation
You just require using composer and you're good to go!
composer require rackbeat/laravel-validate-mysql-integers
The Service Provider is automatically registered.
Usage
Class
Rackbeat\Rules\TinyInteger
Rackbeat\Rules\SmallInteger
Rackbeat\Rules\Integer
Rackbeat\Rules\BigInteger
'number' => [ new Rackbeat\Rules\BigInteger($unsigned = true), ],
Helper
The helpers are prefixed with "real_" to prevent overlapping.
It can take an optional parameter to determine if its unsigned. Defaults to false
.
real_tiny_int
real_small_int
real_int
real_big_int
'id' => ['real_tiny_int:1'], // unsigned 'number' => ['real_tiny_int:0'], // signed
Requirements
- PHP >= 7.1