UserRelation.php 668 B

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