rackbeat/laravel-validate-mysql-integers

验证规则,确保值在有效的MySQL整数范围内。

2.0 2022-11-26 08:33 UTC

This package is auto-updated.

Last update: 2024-08-26 12:23:38 UTC


README

适用于以下类型的带符号和无符号整数:TinyInt, SmallInt, Int, BigInt。

Build Status Coverage Total Downloads Latest Stable Version License

安装

只需使用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

贡献者