ProductAssistSku.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. class ProductAssistSku extends BaseModel
  14. {
  15. /**
  16. * TODO
  17. * @return string
  18. * @author Qinii
  19. * @day 2020-10-12
  20. */
  21. public static function tablePk(): string
  22. {
  23. return '';
  24. }
  25. /**
  26. * TODO
  27. * @return string
  28. * @author Qinii
  29. * @day 2020-10-12
  30. */
  31. public static function tableName(): string
  32. {
  33. return 'store_product_assist_sku';
  34. }
  35. public function sku()
  36. {
  37. return $this->hasOne(ProductAttrValue::class,'unique','unique');
  38. }
  39. public function searchUniqueAttr($query,$value)
  40. {
  41. $query->where('unique',$value);
  42. }
  43. public function searchProductIdAttr($query,$value)
  44. {
  45. $query->where('product_id',$value);
  46. }
  47. public function searchProductAssistIdAttr($query,$value)
  48. {
  49. $query->where('product_assist_id',$value);
  50. }
  51. }