コード例 #1
0
 /**
  * To insert the values to the comment table
  * @param type Article $article
  * @param type Request $request
  * @param type Comment $comment
  * @param type Id $id
  * @return type response
  */
 public function postComment($slug, Article $article, CommentRequest $request, Comment $comment)
 {
     $article = $article->where('slug', $slug)->first();
     $id = $article->id;
     $comment->article_id = $id;
     if ($comment->fill($request->input())->save()) {
         return Redirect::back()->with('success', 'Your comment posted');
     } else {
         return Redirect::back()->with('fails', 'Sorry not processed');
     }
 }