123456789101112131415161718192021222324252627282930 |
- <?php
- namespace app\common\model;
- use app\common\constant\CommonConstant;
- use think\Model;
- /**
- * 商品分类模型
- */
- class GoodsCategory extends Model
- {
- // 表名
- protected $name = 'goods_category';
- // 追加属性
- protected $append = [
- ];
- // 关联子分类
- public function childlist()
- {
- return $this->hasMany(GoodsCategory::class, 'pid', 'id')
- ->where('is_deleted', CommonConstant::IS_DELETED_0)
- ->order('sort desc,id asc');
- }
- }
|