IpConfigValidate.php 910 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. 'type' => 'require|in:1,2',
  13. 'status' => 'integer|in:0,1',
  14. 'remark' => 'length:0,200',
  15. ];
  16. /**
  17. * 参数描述
  18. * @var string[]
  19. */
  20. protected $field = [
  21. 'id' => 'id',
  22. 'ip' => 'IP地址',
  23. 'type' => '类型',
  24. 'status' => '状态',
  25. 'remark' => '备注',
  26. ];
  27. /**
  28. * @notes 编辑场景
  29. */
  30. public function sceneEdit()
  31. {
  32. return $this->only(['ip', 'type', 'status', 'remark']);
  33. }
  34. public function sceneId()
  35. {
  36. return $this->only(['id']);
  37. }
  38. public function sceneStatus()
  39. {
  40. return $this->only(['id', 'field']);
  41. }
  42. }