SensitiveData.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace app\admin\validate;
  3. use think\Validate;
  4. class SensitiveData extends Validate
  5. {
  6. protected $failException = true;
  7. protected $rule = [
  8. 'name' => 'require',
  9. 'controller' => 'require|unique:security_sensitive_data',
  10. 'data_table' => 'require',
  11. 'primary_key' => 'require',
  12. 'data_fields' => 'require',
  13. ];
  14. /**
  15. * 验证提示信息
  16. * @var array
  17. */
  18. protected $message = [];
  19. /**
  20. * 字段描述
  21. */
  22. protected $field = [
  23. ];
  24. /**
  25. * 验证场景
  26. */
  27. protected $scene = [
  28. 'add' => ['name', 'data_fields', 'controller', 'data_table', 'primary_key'],
  29. 'edit' => ['name', 'data_fields', 'controller', 'data_table', 'primary_key'],
  30. ];
  31. public function __construct()
  32. {
  33. $this->field = [
  34. 'name' => __('Name'),
  35. 'data_fields' => __('Data Fields'),
  36. 'controller' => __('Controller'),
  37. 'data_table' => __('Data Table'),
  38. 'primary_key' => __('Primary Key'),
  39. ];
  40. parent::__construct();
  41. }
  42. }