ProductReply.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\common\model\store\product;
  12. use app\common\model\BaseModel;
  13. use app\common\model\store\order\StoreOrderProduct;
  14. use app\common\repositories\store\product\ProductAttrValueRepository;
  15. /**
  16. * Class ProductReply
  17. * @package app\common\model\store\product
  18. * @author xaboy
  19. * @day 2020/5/30
  20. */
  21. class ProductReply extends BaseModel
  22. {
  23. /**
  24. * @Author:Qinii
  25. * @Date: 2020/5/8
  26. * @return string
  27. */
  28. public static function tablePk(): string
  29. {
  30. return 'reply_id';
  31. }
  32. /**
  33. * @Author:Qinii
  34. * @Date: 2020/5/8
  35. * @return string
  36. */
  37. public static function tableName(): string
  38. {
  39. return 'store_product_reply';
  40. }
  41. public function getPicsAttr($value)
  42. {
  43. return $value ? explode(',', $value) : [];
  44. }
  45. public function setPicsAttr($value)
  46. {
  47. return $value ? implode(',', $value) : '';
  48. }
  49. public function product()
  50. {
  51. return $this->hasOne(Product::class, 'product_id', 'product_id');
  52. }
  53. public function orderProduct()
  54. {
  55. return $this->hasOne(StoreOrderProduct::class,'order_product_id','order_product_id');
  56. }
  57. }