ProductAttrDao.php 731 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace app\common\dao\store\product;
  3. use app\common\dao\BaseDao;
  4. use app\common\model\store\product\ProductAttr as model;
  5. class ProductAttrDao extends BaseDao
  6. {
  7. protected function getModel(): string
  8. {
  9. return model::class;
  10. }
  11. /**
  12. * @Author:Qinii
  13. * @Date: 2020/5/9
  14. * @param int $productId
  15. * @return mixed
  16. */
  17. public function clearAttr(int $productId)
  18. {
  19. return ($this->getModel())::where('product_id',$productId)->delete();
  20. }
  21. /**
  22. * @Author:Qinii
  23. * @Date: 2020/5/13
  24. * @param array $data
  25. * @return mixed
  26. */
  27. public function insert(array $data)
  28. {
  29. return ($this->getModel()::getDB())->insertAll($data);
  30. }
  31. }