FarmPackageValidate.php 1.3 KB

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. namespace app\admin\validate\life;
  3. use support\Validate;
  4. class FarmPackageValidate extends Validate
  5. {
  6. protected $rule = [
  7. 'package_id' => 'require|integer',
  8. 'package_shop_id' => 'require|integer',
  9. 'package_category_id' => 'require|integer',
  10. 'package_cate' => 'in:次卡,月卡,年卡',
  11. 'package_type' => 'require|integer',
  12. 'package_name' => 'require',
  13. 'package_image' => 'regex:/^[0-9a-zA-Z\/\.]+$/',
  14. 'package_slide' => 'regex:/^[0-9a-zA-Z\/\.\,]+$/',
  15. 'package_tags' => '/^[\x{4e00}-\x{9fa5}a-zA-Z0-9\_\-\,]+$/u',
  16. 'package_price' => 'require|float',
  17. 'package_grade' => 'integer',
  18. 'package_usefulday' => 'integer',
  19. 'package_sales' => 'integer'
  20. ];
  21. protected $message = [];
  22. protected $scene = [
  23. 'add' => ['package_shop_id', 'package_category_id', 'package_cate', 'package_type', 'package_name', 'package_image', 'package_slide', 'package_tags', 'package_price', 'package_grade', 'package_usefulday', 'package_sales'],
  24. 'update' => ['package_id', 'package_shop_id', 'package_category_id', 'package_cate', 'package_type', 'package_name', 'package_image', 'package_slide', 'package_tags', 'package_price', 'package_grade', 'package_usefulday', 'package_sales'],
  25. ];
  26. }