Helper function to simplify defining validation rules of mixed types
egeniq/laravel-rules is a Laravel package for helper function to simplify defining validation rules of mixed types.
It currently has 0 GitHub stars and 15 downloads on Packagist (latest version 1.0.0).
Install it with composer require egeniq/laravel-rules.
Discover more Laravel packages by egeniq
or browse all Laravel packages to compare alternatives.
Last updated
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()),
]);
composer require egeniq/laravel-rules