SlideCheck.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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 SlideCheck extends Validate
  10. {
  11. protected $rule = [
  12. 'title' => 'require|unique:slide',
  13. 'name' => 'require|unique:slide',
  14. 'id' => 'require',
  15. 'status' => 'require',
  16. 'img' => 'require',
  17. 'slide_id' => 'require',
  18. ];
  19. protected $message = [
  20. 'title.require' => '标题不能为空',
  21. 'title.unique' => '同样的标题已经存在',
  22. 'name.require' => '标识不能为空',
  23. 'name.unique' => '同样的标识已经存在',
  24. 'id.require' => '缺少更新条件',
  25. 'status.require' => '状态为必选',
  26. 'img.require' => '请上传图片',
  27. 'slide_id.require' => '缺少换灯组ID',
  28. ];
  29. protected $scene = [
  30. 'add' => ['title', 'name', 'status'],
  31. 'edit' => ['id', 'title', 'name', 'status'],
  32. 'addInfo' => ['title', 'img', 'status', 'slide_id'],
  33. 'editInfo' => ['title', 'img', 'status', 'id'],
  34. ];
  35. }