本节采用的是 `add` 方法!
```
<?php
namespace app\agent\controller;
use app\agent\model\AgentCategoryModel;
use think\Controller;
class AdminCategoryController extends Controller
{
/**
* 添加文章分类
*/
public function add()
{
//这个是做为子分类而存在的
$parentId = $this->request->param('parent', 0, 'intval');
//获取无限分类
$agentCategoryModel = new AgentCategoryModel();
$categoriesTree = $agentCategoryModel->adminCategoryTree($parentId);
$this->assign('categories_tree', $categoriesTree);
return $this->fetch();
}
}
```