UserRelation.php 744 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace app\common\model\user;
  3. use app\common\model\BaseModel;
  4. use app\common\model\store\product\Product;
  5. use app\common\model\store\product\Spu;
  6. use app\common\model\system\merchant\Merchant;
  7. class UserRelation extends BaseModel
  8. {
  9. public static function tablePk(): ?string
  10. {
  11. return 'uid';
  12. }
  13. public static function tableName(): string
  14. {
  15. return 'user_relation';
  16. }
  17. public function merchant()
  18. {
  19. return $this->hasOne(Merchant::class,'mer_id','type_id');
  20. }
  21. public function product()
  22. {
  23. return $this->hasOne(Product::class,'product_id','type_id');
  24. }
  25. public function spu()
  26. {
  27. return $this->hasOne(Spu::class,'spu_id','type_id');
  28. }
  29. }