Esempio n. 1
0
 public function actionUpdate($id, Requests\UpdateCommentRequest $request)
 {
     // Set logged in user to a variable.
     $authUser = Auth::user();
     // Find comment in database.
     $comment = Comment::where('user_id', '=', $authUser->id)->findOrFail($id);
     // Update comment in database.
     $comment->update($request->all());
     // Redirect with flash message.
     \Session::flash('flash_message', 'You have successfully updated your comment.');
     return redirect('/photos');
 }
 /**
  * Update the specified Comment in storage.
  *
  * @param  int              $id
  * @param UpdateCommentRequest $request
  *
  * @return Response
  */
 public function update($id, UpdateCommentRequest $request)
 {
     $comment = $this->commentRepository->find($id);
     if (empty($comment)) {
         Flash::error('Comment not found');
         return redirect(route('comments.index'));
     }
     $this->commentRepository->updateRich($request->all(), $id);
     Flash::success('Comment updated successfully.');
     return redirect(route('comments.index'));
 }
Esempio n. 3
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(UpdateCommentRequest $request, Comment $comment)
 {
     if (Gate::denies('edit', $comment)) {
         abort(403, 'Sorry, not sorry.');
     }
     $comment->update($request->all());
     return redirect('posts/' . $comment->post_id);
 }