ModuleCheck.php 985 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2021 勾股工作室
  4. * @license https://opensource.org/licenses/GPL-2.0
  5. * @link https://www.gougucms.com
  6. */
  7. namespace app\admin\validate;
  8. use think\Validate;
  9. class ModuleCheck extends Validate
  10. {
  11. protected $rule = [
  12. 'title' => 'require|unique:admin_module',
  13. 'name' => 'require|lower|min:2|unique:admin_module',
  14. 'id' => 'require',
  15. ];
  16. protected $message = [
  17. 'title.require' => '模块名称不能为空',
  18. 'title.unique' => '同样的模块名称已经存在',
  19. 'name.require' => '模块所在目录不能为空',
  20. 'name.lower' => '模块所在目录只能是小写字符',
  21. 'name.min' => '模块所在目录至少需要2个小写字符',
  22. 'name.unique' => '同样的模块所在目录已经存在',
  23. 'id.require' => '缺少更新条件',
  24. ];
  25. protected $scene = [
  26. 'add' => ['title','name'],
  27. 'edit' => ['id','title','name'],
  28. ];
  29. }