Options for Router design
July 23, 2015 ยท View on GitHub
router = $router;
}
public function registerRoutes(Router $router)
{
$router
->route('/articles/-')
->name('article', 'show')
->get(ShowArticleController::class);
}
public function show(Article $article)
{
return $this->router->url('article', 'show', ['id' => $article->getId(), 'title' => $article->getTitle()]);
}
}
class ShowArticleController
{
public function get($article_id)
{
return new PageResult(new ArticlePage(article_api()->getRepo()->getArticle($article_id)));
}
}