public function destroy(Comment $comment) { if ($comment->user_id != Auth::user()->id && !Entrust::hasRole('admin')) { return redirect()->back()->withErrors(config('constants.INVALID_LINK')); } $belongs_to = $comment->belongs_to; $comment->delete(); $activity = 'Deleted a commented on a ' . ucfirst($belongs_to); Activity::log($activity); return redirect()->back()->withSuccess(config('constants.DELETED')); }
/** * Delete comment recursively * * @param \App\Comment $comment * @return bool|null */ public function recursiveDestroy(Comment $comment) { if ($comment->replies->count()) { $comment->replies->each(function ($reply) { if ($reply->replies->count()) { $this->recursiveDestroy($reply); } else { $reply->delete(); } }); } return $comment->delete(); }
/** * Remove the specified resource from storage. * * @param Comment $comment * @return \Illuminate\Http\Response */ public function destroy(Comment $comment) { if ($comment->user()->getResults() != Auth::user()) { return response('Unauthorized.', 401); } return view('posts.show', compact($comment->delete())); }
public function delete(Request $request, Comment $comment) { $comment->delete($request->all()); flash('Your comment has been deleted.', 'error'); return back(); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy(Comment $comment) { $this->authorize('deleteComment', \Auth::user()); $comment->delete(); return redirect(route('article.show', [$comment->article->slug]))->with('flash_success', 'Комментарий успешно удален.'); }
public function destroy(Comment $comment) { $comment->delete(); return redirect('dash/comment')->with('message', 'Page was delete success.'); }
public function destroy(Post $post, Comment $comment) { $comment->delete(); return response(['url' => url('posts/' . $post->slug)]); }
public function adminAnswerDelete(User $user, Comment $comment) { $comment->delete(); Flash::success(trans('admin/message.answerDeleted')); return redirect()->back(); }
/** * Remove the specified resource from storage, if run twice it permanently deletes it * * @param Comment $comment The comment you want to destroy * @return Response */ public function destroy(Comment $comment) { if ($comment->user->id != Auth::user()->id && !Auth::user()->can('delete-comments')) { abort(401, 'User does not have permission to delete this comment'); } $comment->delete(); return $comment; }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy(RentalUnit $rentalUnit, Comment $comment) { $comment->delete(); }