PackageValidate.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace app\admin\validate\life;
  3. use think\Validate;
  4. class PackageValidate extends Validate
  5. {
  6. protected $rule = [
  7. 'package_name' => 'require|max:100',
  8. 'shop_id' => 'require',
  9. 'package_image' => 'require',
  10. 'package_images' => 'require',
  11. 'package_usetime' => 'require',
  12. 'package_tags' => 'require',
  13. 'package_price' => 'require',
  14. 'package_grade' => 'require',
  15. 'package_usefulday' => 'require',
  16. 'package_starttime' => 'require',
  17. 'package_endtime' => 'require',
  18. 'package_intro' => 'require',
  19. 'package_sales' => 'require',
  20. ];
  21. protected $message = [
  22. 'package_name' => '套餐名不能为空',
  23. 'shop_id' => '店铺id不能为空',
  24. 'package_image' => '套餐主图不能为空',
  25. 'package_images' => '套餐轮播图不能为空',
  26. 'package_usetime' => '套餐可用时段不能为空',
  27. 'package_tags' => '套餐标签不能为空',
  28. 'package_price' => '套餐价格不能为空',
  29. 'package_grade' => '套餐评分不能为空',
  30. 'package_usefulday' => '套餐有效期不能为空',
  31. 'package_starttime' => '套餐开始使用时间不能为空',
  32. 'package_endtime' => '套餐结束使用时间不能为空',
  33. 'package_intro' => '购买须知不能为空',
  34. 'package_sales' => '销量不能为空',
  35. ];
  36. //场景
  37. protected $scene = [
  38. 'create' => ['package_name','shop_id','package_image','package_images','package_price','package_usefulday','package_starttime','package_endtime','package_intro'],
  39. 'update' => ['package_id'],
  40. 'info' => ['package_id']
  41. ];
  42. }