PackageValidate.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace app\admin\validate\package;
  3. use think\Validate;
  4. class PackageValidate extends Validate
  5. {
  6. protected $rule = [
  7. 'package_name' => 'require|max:20',
  8. 'package_img' => 'require',
  9. 'package_id' => 'require',
  10. 'package_logo' => 'require',
  11. 'package_type' => 'require',
  12. 'package_content' => 'require',
  13. 'package_product_ids' => 'require',
  14. 'user_id' => 'require',
  15. 'type' => 'require',
  16. ];
  17. protected $message = [
  18. 'package_name.require' => '包名1称不能为空',
  19. 'package_id.require' => 'id不能为空',
  20. 'package_img.require' => '介绍图不能为空',
  21. 'package_logo.require' => 'logo不能为空',
  22. 'package_name.max' => '包名不能超过20字',
  23. 'package_type.require' => '类型不能为空',
  24. 'package_content.require' => '购买须知不能为空',
  25. 'package_product_ids.require' => '品产不能为空',
  26. 'user_id.require' => '赠送会员编号不能为空',
  27. 'type.require' => '类型不能为空'
  28. ];
  29. //场景
  30. protected $scene = [
  31. 'add' => ['package_name','package_img','package_logo','package_type','package_content','package_product_ids',],
  32. 'update' => ['package_id'],
  33. 'info' => ['package_id'],
  34. 'del' => ['package_id'],
  35. 'give' => ['package_id', 'user_id', 'type']
  36. ];
  37. }