ConfigValidate.php 722 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace app\admin\validate\index;
  3. use think\Validate;
  4. class ConfigValidate extends Validate
  5. {
  6. //定义规则
  7. protected $rule = [
  8. 'classify_name' => 'require',
  9. 'classify_key' => 'require',
  10. 'classify_id' => 'require',
  11. ];
  12. //定义描述
  13. protected $message = [
  14. 'classify_name.require' => '分类名称不能为空',
  15. 'classify_key.require' => '分类键名不能为空',
  16. 'classify_id.require' => '分类编号不能为空'
  17. ];
  18. //定义场景
  19. protected $scene = [
  20. 'add' => ['classify_name','classify_key'],
  21. 'up' => ['classify_name','classify_key', 'classify_id'],
  22. 'del_up' => ['classify_id'],
  23. ];
  24. }