egeniq / laravel-rules
Helper function to simplify defining validation rules of mixed types
1.0.0
2018-02-09 15:44 UTC
Requires
- php: ^7.0
- illuminate/support: ~5.5.0|~5.6.0
Requires (Dev)
- orchestra/testbench: ~3.5.0|~3.6.0
- phpunit/phpunit: ~7.0.0
This package is not auto-updated.
Last update: 2024-12-13 04:43:14 UTC
README
Helper function to simplify defining validation rules of mixed types
The helper enables you to use mixed format when defining validation rules in a controller. This is especially helpful when you want to add a custom rule to a list of rules that are in the string format.
// Before $validation = validator($data, [ 'id' => 'required|integer', 'amount' => [ 'required', 'integer', new MyCustomRule() ], ]); // After $validation = validator($data, [ 'id' => 'required|integer', 'amount' => rules('required|integer', new MyCustomRule()), ]);
Installation
composer require egeniq/laravel-rules