和前面一样,我们要在 app/controllers/ArticlesController.php 文件中更改 show 动作,以及相应的视图文件。
public function show($id)
{
$article = Article::find($id);
return View::make("articles.show", compact("article"));
}
然后,新建 app/views/articles/show.blade.php 文件,写入下面的代码:
<p>
<strong>Title:</strong>
{{ $article->title }}
</p>
<p>
<strong>Text:</strong>
{{ $article->text }}
</p>
做了以上修改后,就能真正的新建文章了。访问 http://localhost:8000/articles/create ,自己试试。