Attachment.php 705 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace app\common\model\system\attachment;
  3. use app\common\model\BaseModel;
  4. class Attachment 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 'attachment_id';
  14. }
  15. /**
  16. * @return string
  17. * @author zfy
  18. * @day 2020-03-30
  19. */
  20. public static function tableName(): string
  21. {
  22. return 'system_attachment';
  23. }
  24. public function parent()
  25. {
  26. return $this->hasOne(self::class, 'config_classify_id', 'pid');
  27. }
  28. public function children()
  29. {
  30. return $this->hasMany(self::class, 'pid', 'config_classify_id');
  31. }
  32. }