ProductReply.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. namespace app\common\model\store\product;
  3. use app\common\model\BaseModel;
  4. use app\common\model\store\order\StoreOrderProduct;
  5. use app\common\repositories\store\product\ProductAttrValueRepository;
  6. /**
  7. * Class ProductReply
  8. * @package app\common\model\store\product
  9. * @author zfy
  10. * @day 2020/5/30
  11. */
  12. class ProductReply extends BaseModel
  13. {
  14. /**
  15. * @Author:Qinii
  16. * @Date: 2020/5/8
  17. * @return string
  18. */
  19. public static function tablePk(): string
  20. {
  21. return 'reply_id';
  22. }
  23. /**
  24. * @Author:Qinii
  25. * @Date: 2020/5/8
  26. * @return string
  27. */
  28. public static function tableName(): string
  29. {
  30. return 'store_product_reply';
  31. }
  32. public function getPicsAttr($value)
  33. {
  34. return $value ? explode(',', $value) : [];
  35. }
  36. public function setPicsAttr($value)
  37. {
  38. return $value ? implode(',', $value) : '';
  39. }
  40. public function product()
  41. {
  42. return $this->hasOne(Product::class, 'product_id', 'product_id');
  43. }
  44. public function orderProduct()
  45. {
  46. return $this->hasOne(StoreOrderProduct::class,'order_product_id','order_product_id');
  47. }
  48. }