HousekeeperValidate.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace app\admin\validate\housekeeper;
  3. use think\Validate;
  4. class HousekeeperValidate extends Validate
  5. {
  6. //定义规则
  7. protected $rule = [
  8. 'housekeeper_name' => 'require',
  9. 'housekeeper_pwd' => 'require',
  10. 'housekeeper_real_name' => 'require',
  11. 'housekeeper_phone' => 'require',
  12. 'housekeeper_position' => 'require',
  13. 'housekeeper_id' => 'require'
  14. ];
  15. //定义描述
  16. protected $message = [
  17. 'housekeeper_name.require' => '管家账号不能为空',
  18. 'housekeeper_pwd.require' => '管家密码不能为空',
  19. 'housekeeper_real_name.require' => '管家真实姓名不能为空',
  20. 'housekeeper_phone.require' => '管家手机号不能为空',
  21. 'housekeeper_position.require' => '管家职位不能为空',
  22. 'housekeeper_id.require' => '管家编号不能为空'
  23. ];
  24. //定义场景
  25. protected $scene = [
  26. 'add' => ['housekeeper_name','housekeeper_pwd', 'housekeeper_real_name', 'housekeeper_phone', 'housekeeper_position'],
  27. 'up' => ['housekeeper_name','housekeeper_real_name', 'housekeeper_phone', 'housekeeper_position', 'housekeeper_id'],
  28. 'info' => ['housekeeper_id'],
  29. 'del' => ['housekeeper_id']
  30. ];
  31. }