linksCheck.php 890 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2021 勾股工作室
  4. * @license https://opensource.org/licenses/Apache-2.0
  5. * @link https://blog.gougucms.com
  6. */
  7. declare (strict_types = 1);
  8. namespace app\admin\validate;
  9. use think\Validate;
  10. class linksCheck extends Validate
  11. {
  12. protected $rule = [
  13. 'name' => 'require|unique:links',
  14. 'src' => 'require|url|unique:links',
  15. 'id' => 'require',
  16. ];
  17. protected $message = [
  18. 'name.require' => '网站名称不能为空',
  19. 'name.unique' => '同样的网站名称已经存在',
  20. 'src' => '网站链接不能为空',
  21. 'src.url' => '网站链接不是有效的URL地址',
  22. 'src.unique' => '同样的网站链接已经存在',
  23. 'id.require' => '缺少更新条件',
  24. ];
  25. protected $scene = [
  26. 'add' => ['name', 'src'],
  27. 'edit' => ['id', 'name', 'src'],
  28. ];
  29. }