コード例 #1
0
 public function legacyShow($id)
 {
     $article = Article::findOrFail($id);
     $date = $article->pubdate->toDateString();
     $slug = $article->slug;
     // @TODO: Add a flash message to let the user know they were redirected
     // and where they should go in the future
     return redirect()->route('articleShow', [$date, $slug]);
 }
コード例 #2
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $article = Article::findOrFail($id);
     $draft = $article->latestDraft();
     return view('articles.show', compact('article', 'draft'));
 }