MerchantIntention.php 1010 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace app\common\model\system\merchant;
  3. use app\common\model\BaseModel;
  4. class MerchantIntention extends BaseModel
  5. {
  6. /**
  7. * @return string
  8. * @author zfy
  9. * @day 2020-03-30
  10. */
  11. public static function tablePk(): string
  12. {
  13. return 'mer_intention_id';
  14. }
  15. /**
  16. * @return string
  17. * @author zfy
  18. * @day 2020-03-30
  19. */
  20. public static function tableName(): string
  21. {
  22. return 'merchant_intention';
  23. }
  24. public function setImagesAttr($value)
  25. {
  26. return implode(',', $value);
  27. }
  28. public function getImagesAttr($value)
  29. {
  30. return $value ? explode(',', $value) : [];
  31. }
  32. public function merchantCategory()
  33. {
  34. return $this->hasOne(MerchantCategory::class, 'merchant_category_id', 'merchant_category_id')->bind(['category_name']);
  35. }
  36. public function merchantType()
  37. {
  38. return $this->hasOne(MerchantType::class, 'mer_type_id', 'mer_type_id')->bind(['type_name']);
  39. }
  40. }