NavCheck.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2021 勾股工作室
  4. * @license https://opensource.org/licenses/Apache-2.0
  5. * @link https://www.gougucms.com
  6. */
  7. namespace app\admin\validate;
  8. use think\Validate;
  9. class NavCheck extends Validate
  10. {
  11. protected $rule = [
  12. 'title' => 'require|unique:nav',
  13. 'name' => 'require|unique:nav',
  14. 'id' => 'require',
  15. 'status' => 'require',
  16. 'slide_id' => 'require',
  17. ];
  18. protected $message = [
  19. 'title.require' => '标题不能为空',
  20. 'title.unique' => '同样的标题已经存在',
  21. 'name.require' => '标识不能为空',
  22. 'name.unique' => '同样的标识已经存在',
  23. 'id.require' => '缺少更新条件',
  24. 'status.require' => '状态为必选',
  25. 'slide_id.require' => '缺少导航组ID',
  26. 'filed.require' => '缺少要更新的字段名',
  27. ];
  28. protected $scene = [
  29. 'add' => ['title', 'name', 'status'],
  30. 'edit' => ['id', 'title', 'name', 'status'],
  31. 'addInfo' => ['title', 'nav_id'],
  32. 'editInfo' => ['id', 'title'],
  33. ];
  34. }