Micro Dream Form Validate
Enhanced form validate - Manage validate scene
class UserValidate extends Validate
{
protected $rule = [
'user' => 'required|email',
'pass' => 'required|lengthBetween:6,16',
'name' => 'required|chs'
];
protected $scene = [
'login' => ['user', 'pass'],
'register' => ['user', 'pass', 'name'],
];
}
// Login Business
$data = (new UserValidate())->scene('login')->check($userInput);
// Registration Business
$data = (new UserValidate())->scene('register')->check($userInput);
Rules Management
Convenient and fast management, generation, and extraction of required validation rules, reusable rules, and private rules.
Validation Scene
Arbitrary combination of validation rules, dynamic generation of appropriate validation rules
Error message
Multiple error message definition methods, default rule messages, and support for multiple variables to use, making your interactions more clear and understandable