ProductValidate.php 749 B

123456789101112131415161718192021222324252627
  1. <?php
  2. namespace app\admin\validate\intelligence;
  3. use think\Validate;
  4. class ProductValidate extends Validate
  5. {
  6. protected $rule = [
  7. 'product_name' => 'require|max:20',
  8. 'product_id' => 'require',
  9. 'product_category_id' => 'require',
  10. ];
  11. protected $message = [
  12. 'product_name.require' => '智能产品名称不能为空',
  13. 'product_id.require' => '产品id不能为空',
  14. 'product_name.max' => '智能产品名称不能超过20字',
  15. 'product_category_id' => '分类id不能为空',
  16. ];
  17. //场景
  18. protected $scene = [
  19. 'create' => ['product_name','product_category_id'],
  20. 'update' => ['product_id'],
  21. 'info' => ['product_id']
  22. ];
  23. }