Template.php 643 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace app\admin\validate\sms;
  3. use think\Validate;
  4. class Template extends Validate
  5. {
  6. protected $failException = true;
  7. /**
  8. * 验证规则
  9. */
  10. protected $rule = [
  11. 'code' => 'require|regex:^[a-zA-Z][a-zA-Z0-9_]{2,50}$|unique:sms_template',
  12. ];
  13. /**
  14. * 提示消息
  15. */
  16. protected $message = [
  17. ];
  18. /**
  19. * 验证场景
  20. */
  21. protected $scene = [
  22. 'add' => ['code'],
  23. 'edit' => ['code'],
  24. ];
  25. public function __construct()
  26. {
  27. $this->field = [
  28. 'code' => '模板唯一标识',
  29. ];
  30. parent::__construct();
  31. }
  32. }