SystemCity.php 640 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace app\models\system;
  3. use crmeb\traits\ModelTrait;
  4. use crmeb\basic\BaseModel;
  5. /**
  6. * 菜单 model
  7. * Class SystemMenus
  8. * @package app\admin\model\system
  9. */
  10. class SystemCity extends BaseModel
  11. {
  12. /**
  13. * 数据表主键
  14. * @var string
  15. */
  16. protected $pk = 'id';
  17. /**
  18. * 模型名称
  19. * @var string
  20. */
  21. protected $name = 'system_city';
  22. use ModelTrait;
  23. /**
  24. * 获取子集分类查询条件
  25. * @return \think\model\relation\HasMany
  26. */
  27. public function children()
  28. {
  29. return $this->hasMany(self::class, 'parent_id', 'city_id')->order('id DESC');
  30. }
  31. }