ProductAssistSku.php 951 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace app\common\model\store\product;
  3. use app\common\model\BaseModel;
  4. class ProductAssistSku extends BaseModel
  5. {
  6. /**
  7. * TODO
  8. * @return string
  9. * @author Qinii
  10. * @day 2020-10-12
  11. */
  12. public static function tablePk(): string
  13. {
  14. return '';
  15. }
  16. /**
  17. * TODO
  18. * @return string
  19. * @author Qinii
  20. * @day 2020-10-12
  21. */
  22. public static function tableName(): string
  23. {
  24. return 'store_product_assist_sku';
  25. }
  26. public function sku()
  27. {
  28. return $this->hasOne(ProductAttrValue::class,'unique','unique');
  29. }
  30. public function searchUniqueAttr($query,$value)
  31. {
  32. $query->where('unique',$value);
  33. }
  34. public function searchProductIdAttr($query,$value)
  35. {
  36. $query->where('product_id',$value);
  37. }
  38. public function searchProductAssistIdAttr($query,$value)
  39. {
  40. $query->where('product_assist_id',$value);
  41. }
  42. }