public function addGroup(RouteGroup $group) { foreach ($group->getRoutes() as $route) { $this->routes[] = $route; } $this->groups[] = $group; }
$route->get('/')->as('index')->uses('getIndex'); # 修改当前账号密码 $route->get('change-password')->as('changePassword')->uses('getChangePassword'); $route->put('change-password')->uses('putChangePassword'); # 更改头像 $route->get('change-portrait')->as('changePortrait')->uses('getChangePortrait'); $route->put('change-portrait')->uses('putChangePortrait'); # 我的评论管理 $route->get('my-comments')->as('myComments')->uses('getMyComments'); $route->delete('my-comments/{id}')->as('myComments.destroy')->uses('deleteMyComment'); }); /* |-------------------------------------------------------------------------- | 博客 |-------------------------------------------------------------------------- */ RouteGroup::make()->controller('BlogController')->go(function ($route) { # 博客首页 $route->get('/')->as('home')->uses('getIndex'); # 分类文章列表 $route->get('category/{id}')->as('categoryArticles')->uses('getCategoryArticles'); # 展示博客文章 $route->get('{slug}')->as('blog.show')->uses('getBlogShow'); # 提交文章评论 $route->post('{slug}')->uses('postBlogComment')->before('auth'); }); /* |-------------------------------------------------------------------------- | 特殊功能 |-------------------------------------------------------------------------- */