IpConfigValidate.php 838 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. namespace app\admin\validate;
  3. class IpConfigValidate extends BaseValidate
  4. {
  5. /**
  6. * 设置校验规则
  7. * @var string[]
  8. */
  9. protected $rule = [
  10. 'id' => 'require',
  11. 'ip' => 'require|ip',
  12. 'status' => 'integer|in:0,1',
  13. 'remark' => 'length:0,100',
  14. ];
  15. /**
  16. * 参数描述
  17. * @var string[]
  18. */
  19. protected $field = [
  20. 'id' => 'id',
  21. 'ip' => 'IP地址',
  22. 'status' => '状态',
  23. 'remark' => '备注',
  24. ];
  25. /**
  26. * @notes 编辑场景
  27. */
  28. public function sceneEdit()
  29. {
  30. return $this->only(['ip', 'status', 'remark']);
  31. }
  32. public function sceneId()
  33. {
  34. return $this->only(['id']);
  35. }
  36. public function sceneStatus()
  37. {
  38. return $this->only(['id', 'field']);
  39. }
  40. }