risan / lara-rules
Laravel自定义验证规则。
v1.0.2
2022-03-02 16:25 UTC
Requires
- php: ^7.3|^8.0
- illuminate/contracts: ^8.0|^9.0
- illuminate/support: ^8.0|^9.0
README
Laravel自定义验证规则。
安装
此包要求您使用Laravel版本8。通过Composer安装此包。
$ composer require risan/lara-rules
用法
use Risan\LaraRules\USPhoneWithDash; $request->validate([ 'phone' => ['required', 'string', new USPhoneWithDash], // Valid: 123-456-7890 'state' => ['required', 'string', new USStateCode], // Valid: CA, TX 'zip_code' => ['required', 'string', new USZipCode], // Valid: 90120 or 20521-9000 ]);
USPhoneWithDash
:带有短划线的10位美国电话号码。USStateCode
:2位美国州代码。USZipCode
:5位或9位美国邮政编码。