BannerValidate.php 820 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace app\admin\validate;
  3. class BannerValidate extends BaseValidate
  4. {
  5. /**
  6. * 设置校验规则
  7. * @var string[]
  8. */
  9. protected $rule = [
  10. 'title' => 'nullable',
  11. 'image' => 'require',
  12. 'link' => 'nullable',
  13. 'type' => 'nullable',
  14. 'sort' => 'nullable|numeric',
  15. ];
  16. /**
  17. * 参数描述
  18. * @var string[]
  19. */
  20. protected $field = [
  21. 'title' => '标题',
  22. 'image' => '图片',
  23. 'link' => '链接',
  24. 'type' => '类型',
  25. 'sort' => '排序',
  26. ];
  27. /**
  28. * @notes 编辑场景
  29. */
  30. public function sceneEdit()
  31. {
  32. return $this->only(['id','title', 'image', 'link', 'type', 'sort']);
  33. }
  34. public function sceneId()
  35. {
  36. return $this->only(['id']);
  37. }
  38. }