Category.php
602 字节
<?php
namespace app\admin\model\groupon;
use think\Model;
/**
* 分类模型
*/
class Category extends Model
{
// 表名,不含前缀
protected $name = 'groupon_category';
// 开启自动写入时间戳字段
protected $autoWriteTimestamp = 'int';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
// 追加属性
protected $append = [
];
public function children ()
{
return $this->hasMany(\app\admin\model\groupon\Category::class, 'pid', 'id')->order('weigh desc, id asc');
}
}