利用模型实现
class Cate extends Model
{
protected $append = ['children'];
public function getChildrenAttr($value,$data)
{
return Cate::where('fid',$data['id'])->select();
}
}
$data = (new CateModel())->where(['status'=>1,'recomm'=>1])->select();