BroadcastGoodsValidate.php 513 B

123456789101112131415161718192021222324252627
  1. <?php
  2. namespace app\validate\merchant;
  3. use think\Validate;
  4. class BroadcastGoodsValidate extends Validate
  5. {
  6. protected $failException = true;
  7. protected $rule = [
  8. 'name|商品名称' => 'require|min:3|max:14',
  9. 'cover_img|商品图' => 'require',
  10. 'price|价格' => 'require|min:0.01',
  11. 'product_id|商品' => 'require|array|length:2',
  12. ];
  13. public function isBatch()
  14. {
  15. $this->rule['product_id|商品'] = 'require|integer';
  16. return $this;
  17. }
  18. }