packageGoodsValidate.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace app\admin\validate\package;
  3. use think\Validate;
  4. class PackageGoodsValidate extends Validate
  5. {
  6. protected $rule = [
  7. 'goods_name' => 'require',
  8. 'goods_titile' => 'require',
  9. 'goods_id' => 'require',
  10. 'goods_category_id' => 'require',
  11. 'goods_price' => 'require',
  12. 'goods_nape' => 'require',
  13. 'goods_equity' => 'require',
  14. 'goods_img' => 'require|min:0',
  15. 'goods_status' => 'require',
  16. 'goods_num' => 'require',
  17. 'goods_num_type' => 'require',
  18. 'goods_num_unit' => 'require',
  19. 'goods_type' => 'require',
  20. ];
  21. protected $message = [
  22. 'goods_name.require' => '产品名称称不能为空',
  23. 'goods_id.require' => 'id不能为空',
  24. 'goods_category_id.require' => '所属分类不能为空',
  25. 'goods_titile.require' => '简介不能为空',
  26. 'goods_equity.require' => '服务权益不能为空',
  27. 'goods_img.require' => '图片不能为空',
  28. 'goods_nape.require' => '服务细项不能为空',
  29. 'goods_type.require' => '权益类型不能为空',
  30. 'goods_status.require' => '状态不能为空',
  31. 'goods_num.require' => '使用次数不能为空',
  32. 'goods_num_type.require' => '有效天数不能为空',
  33. 'goods_num_unit.require' => '单位不能为空',
  34. 'goods_price.require' => '价格不能为空',
  35. ];
  36. //场景
  37. protected $scene = [
  38. 'add' => ['goods_name','goods_category_id','goods_price','goods_type','goods_titile','goods_equity','goods_img','goods_nape','goods_num','goods_num_unit','goods_num_type',],
  39. 'update' => ['goods_id'],
  40. 'info' => ['goods_id'],
  41. 'del' => ['goods_id']
  42. ];
  43. }