Attachment.php 781 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /**
  3. * @package merchant
  4. *
  5. * @author xaboy
  6. * @day 2020-03-24
  7. *
  8. *
  9. */
  10. namespace app\common\model\system\attachment;
  11. use app\common\model\BaseModel;
  12. class Attachment extends BaseModel
  13. {
  14. /**
  15. * @return string
  16. * @author xaboy
  17. * @day 2020-03-30
  18. */
  19. public static function tablePk(): string
  20. {
  21. return 'attachment_id';
  22. }
  23. /**
  24. * @return string
  25. * @author xaboy
  26. * @day 2020-03-30
  27. */
  28. public static function tableName(): string
  29. {
  30. return 'system_attachment';
  31. }
  32. public function parent()
  33. {
  34. return $this->hasOne(self::class, 'config_classify_id', 'pid');
  35. }
  36. public function children()
  37. {
  38. return $this->hasMany(self::class, 'pid', 'config_classify_id');
  39. }
  40. }