CouponValidate.php 826 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace app\admin\validate\coupon;
  3. use support\Validate;
  4. class CouponValidate extends Validate
  5. {
  6. /**
  7. * 规则
  8. * @var string[]
  9. */
  10. protected $rule = [
  11. 'coupon_id' => 'require|alphaDash',
  12. 'coupon_status|优惠券状态' => 'require|in:ACTIVED,DISABLED',
  13. 'coupon_category|分类' => 'max:32',
  14. 'coupon_name|名称' => 'require|max:32',
  15. 'coupon_begindate|启用日期' => 'require',
  16. 'coupon_enddate|过期时间' => 'require',
  17. ];
  18. /**
  19. * 场景
  20. * @var array[]
  21. */
  22. protected $scene = [
  23. 'add' => ['coupon_status', 'coupon_category', 'coupon_name', 'coupon_begindate', 'coupon_enddate'],
  24. 'update' => ['coupon_id', 'coupon_status', 'coupon_category', 'coupon_name', 'coupon_begindate', 'coupon_enddate'],
  25. ];
  26. }